Skip to content

Commit

Permalink
fix e2e
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewseguin committed Nov 9, 2016
1 parent 962ebf4 commit 95e81f4
Showing 1 changed file with 16 additions and 7 deletions.
23 changes: 16 additions & 7 deletions e2e/components/tabs/tabs.e2e.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,17 @@ describe('tabs', () => {
browser.get('/tabs');
tabGroup = element(by.css('md-tab-group'));
tabLabels = element.all(by.css('.md-tab-label'));
tabBodies = element.all(by.css('.md-tab-body'));
tabBodies = element.all(by.css('md-tab-body'));
});

it('should change tabs when the label is clicked', () => {
tabLabels.get(1).click();
expect(getActiveStates(tabLabels)).toEqual([false, true, false]);
expect(getActiveStates(tabBodies)).toEqual([false, true, false]);
expect(getLabelActiveStates(tabLabels)).toEqual([false, true, false]);
expect(getBodyActiveStates(tabBodies)).toEqual([false, true, false]);

tabLabels.get(0).click();
expect(getActiveStates(tabLabels)).toEqual([true, false, false]);
expect(getActiveStates(tabBodies)).toEqual([true, false, false]);
expect(getLabelActiveStates(tabLabels)).toEqual([true, false, false]);
expect(getBodyActiveStates(tabBodies)).toEqual([true, false, false]);
});

it('should change focus with keyboard interaction', () => {
Expand Down Expand Up @@ -77,8 +77,17 @@ function getFocusStates(elements: ElementArrayFinder) {
* @param elements
* @returns {webdriver.promise.Promise<Promise<boolean>[]>|webdriver.promise.Promise<T[]>}
*/
function getActiveStates(elements: ElementArrayFinder) {
return getClassStates(elements, 'md-tab-active');
function getLabelActiveStates(elements: ElementArrayFinder) {
return getClassStates(elements, 'md-tab-label-active');
}

/**
* Returns an array of true/false that represents the active states for the provided elements
* @param elements
* @returns {webdriver.promise.Promise<Promise<boolean>[]>|webdriver.promise.Promise<T[]>}
*/
function getBodyActiveStates(elements: ElementArrayFinder) {
return getClassStates(elements, 'md-tab-body-active');
}

/**
Expand Down

0 comments on commit 95e81f4

Please sign in to comment.