Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(tabs): adds e2e tests for tabs #650

Merged
merged 1 commit into from
Jul 7, 2016
Merged

feat(tabs): adds e2e tests for tabs #650

merged 1 commit into from
Jul 7, 2016

Conversation

robertmesserle
Copy link
Contributor

closes #549

R: @jelbourn

@googlebot googlebot added the cla: yes PR author has agreed to Google's Contributor License Agreement label Jun 8, 2016
@@ -1,6 +1,6 @@
<!doctype html>
{{!-- This file is an handlebar file that gets filled at build time. --}}
<html>
<html lang="en">
Copy link
Member

@jelbourn jelbourn Jun 8, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Update this for demo-app as well?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You could probably use this PR for the a11y test fixes instead of #654 (because lang="en" on the demo-app will fix one)

@jelbourn jelbourn mentioned this pull request Jun 8, 2016
.toMatch('md-active');

element(by.css('.md-tab-label:nth-of-type(1)')).click();
expect(element(by.css('.md-tab-label:nth-of-type(2)')).getAttribute('class')).not

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To assert that the tabs contain a class you can do something like this:

// Note: $$('.abc') === element.all(by.css('.abc'))
let tabsActive = $$('.md-tab-label').map((item, index) => {
  // Note: I am creating an array that contains {index, isActive} where isActive means that
  // it has the active class
  return {
    index: index,
    isActive: item.getAttribute('class').then(
        classAttr => !!classAttr.match('dropdown'))
  };
});

expect(tabsActive).toEqual([
  {index: 0, isActive: false}, 
  {index: 1, isActive: true},
  {index: 2, isActive: false}
]);

Or you can just do:

let tabsActive = $$('.md-tab-label')
    .map(item => item.getAttribute('class')
        .then(classAttr => !!classAttr.match('dropdown')));

expect(tabsActive).toEqual([false, true, false]);

@robertmesserle
Copy link
Contributor Author

@jelbourn This should be okay to merge now.

@@ -0,0 +1,76 @@
import ElementArrayFinder = protractor.ElementArrayFinder;
import ElementFinder = protractor.ElementFinder;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

import {ElementArrayFinder} from ... ? etc.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Apparently, this is how WebStorm fixed my code.

@jelbourn
Copy link
Member

@robertmesserle needs a rebase on top of the new router. LGTM aside from that (and one minor nit).

Feel free to merge directly after rebase.

@robertmesserle robertmesserle merged commit 3c74ae0 into angular:master Jul 7, 2016
@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Sep 6, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
cla: yes PR author has agreed to Google's Contributor License Agreement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add e2e tests for tabs
5 participants