本文整理匯總了TypeScript中@angular/cdk/testing/e2e.getScrollPosition函數的典型用法代碼示例。如果您正苦於以下問題:TypeScript getScrollPosition函數的具體用法?TypeScript getScrollPosition怎麽用?TypeScript getScrollPosition使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了getScrollPosition函數的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: it
it('should not be able to scroll programmatically along the x axis', async () => {
await scrollPage(0, 100);
expect((await getScrollPosition()).y).toBe(100, 'Expected the page to be scrollable.');
await clickOn('enable');
await scrollPage(0, 200);
expect((await getScrollPosition()).y).toBe(100, 'Expected the page not to be scrollable.');
await clickOn('disable');
await scrollPage(0, 300);
expect((await getScrollPosition()).y).toBe(300, 'Exected page to be scrollable again.');
});
示例2: async
async () => {
const scroller = element(by.id('scroller'));
await browser.executeScript(`document.getElementById('scroller').scrollLeft = 200;`);
await scrollPage(100, 0);
expect((await getScrollPosition()).x).toBe(100, 'Expected the page to be scrollable.');
await clickOn('enable');
await scroller.sendKeys(Key.ARROW_RIGHT);
await scroller.sendKeys(Key.ARROW_RIGHT);
await scroller.sendKeys(Key.ARROW_RIGHT);
expect((await getScrollPosition()).x).toBe(100, 'Expected the page not to have scrolled.');
});