Skip to content

Commit

Permalink
update carousel tests to use queryElements
Browse files Browse the repository at this point in the history
  • Loading branch information
smhigley committed May 3, 2020
1 parent 666837f commit 0f80db3
Showing 1 changed file with 13 additions and 13 deletions.
26 changes: 13 additions & 13 deletions test/tests/carousel_carousel-2-tablist.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ const ex = {
};

const openTabAtIndex = async function (t, index) {
const tabs = await t.context.session.findElements(By.css(ex.tabSelector));
const tabs = await t.context.queryElements(t, ex.tabSelector);
await tabs[index].click();
};

Expand All @@ -57,7 +57,7 @@ const waitAndCheckFocus = async function (t, selector, index) {

const waitAndCheckAriaSelected = async function (t, index) {
return t.context.session.wait(async function () {
const tabs = await t.context.session.findElements(By.css(ex.tabSelector));
const tabs = await t.context.queryElements(t, ex.tabSelector);
return (await tabs[index].getAttribute('aria-selected')) === 'true';
}, t.context.waitTime, 'Timeout waiting for aria-selected to be set to true.');
};
Expand Down Expand Up @@ -113,8 +113,8 @@ ariaTest('"aria-label" attribute on role="tab"', exampleFile, 'tab-aria-label',
ariaTest('"aria-selected" set on role="tab"', exampleFile, 'tab-aria-selected', async (t) => {
t.plan(2 * ex.tabCount * ex.tabCount);

let tabs = await t.context.session.findElements(By.css(ex.tabSelector));
let tabpanels = await t.context.session.findElements(By.css(ex.tabpanelSelector));
let tabs = await t.context.queryElements(t, ex.tabSelector);
let tabpanels = await t.context.queryElements(t, ex.tabpanelSelector);

for (let selectedEl = 0; selectedEl < tabs.length; selectedEl++) {

Expand Down Expand Up @@ -148,7 +148,7 @@ ariaTest('"aria-selected" set on role="tab"', exampleFile, 'tab-aria-selected',
ariaTest('"tabindex" on role="tab"', exampleFile, 'tab-tabindex', async (t) => {
t.plan(ex.tabCount * ex.tabCount);

let tabs = await t.context.session.findElements(By.css(ex.tabSelector));
let tabs = await t.context.queryElements(t, ex.tabSelector);
for (let selectedEl = 0; selectedEl < tabs.length; selectedEl++) {

// Open the tab
Expand Down Expand Up @@ -256,8 +256,8 @@ ariaTest('ARROW_RIGHT key moves focus and activates tab', exampleFile, 'key-righ
// Put focus on first tab
await openTabAtIndex(t, 0);

const tabs = await t.context.session.findElements(By.css(ex.tabSelector));
const tabpanels = await t.context.session.findElements(By.css(ex.tabpanelSelector));
const tabs = await t.context.queryElements(t, ex.tabSelector);
const tabpanels = await t.context.queryElements(t, ex.tabpanelSelector);
for (let index = 0; index < tabs.length - 1; index++) {

// Send the arrow right key to move focus
Expand Down Expand Up @@ -302,8 +302,8 @@ ariaTest('ARROW_RIGHT key moves focus and activates tab', exampleFile, 'key-righ
ariaTest('ARROW_LEFT key moves focus and activates tab', exampleFile, 'key-left-arrow', async (t) => {
t.plan(3 * ex.tabCount);

const tabs = await t.context.session.findElements(By.css(ex.tabSelector));
const tabpanels = await t.context.session.findElements(By.css(ex.tabpanelSelector));
const tabs = await t.context.queryElements(t, ex.tabSelector);
const tabpanels = await t.context.queryElements(t, ex.tabpanelSelector);

// Put focus on first tab
await openTabAtIndex(t, 0);
Expand Down Expand Up @@ -350,8 +350,8 @@ ariaTest('ARROW_LEFT key moves focus and activates tab', exampleFile, 'key-left-
ariaTest('HOME key moves focus and selects tab', exampleFile, 'key-home', async (t) => {
t.plan(3 * ex.tabCount);

const tabs = await t.context.session.findElements(By.css(ex.tabSelector));
const tabpanels = await t.context.session.findElements(By.css(ex.tabpanelSelector));
const tabs = await t.context.queryElements(t, ex.tabSelector);
const tabpanels = await t.context.queryElements(t, ex.tabpanelSelector);
for (let index = 0; index < tabs.length; index++) {

// Put focus on the tab
Expand Down Expand Up @@ -379,8 +379,8 @@ ariaTest('HOME key moves focus and selects tab', exampleFile, 'key-home', async
ariaTest('END key moves focus and selects tab', exampleFile, 'key-end', async (t) => {
t.plan(3 * ex.tabCount);

const tabs = await t.context.session.findElements(By.css(ex.tabSelector));
const tabpanels = await t.context.session.findElements(By.css(ex.tabpanelSelector));
const tabs = await t.context.queryElements(t, ex.tabSelector);
const tabpanels = await t.context.queryElements(t, ex.tabpanelSelector);
for (let index = 0; index < tabs.length; index++) {

// Put focus on the tab
Expand Down

0 comments on commit 0f80db3

Please sign in to comment.