aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJulie2014-02-12 15:07:08 -0800
committerPeter Bacon Darwin2014-02-16 19:03:42 +0000
commit9565cca15b6d30aefb78bcec411dea4f7b305019 (patch)
tree1c0d58d7541b7d6fb96fb1d1d068d48eb0fca97a /src
parentcd508678cd9baffd2bc0c9e11ae724a7b2ff70bb (diff)
downloadangular.js-9565cca15b6d30aefb78bcec411dea4f7b305019.tar.bz2
chore(protractor tests): fix up e2e tests
Diffstat (limited to 'src')
-rw-r--r--src/ng/directive/booleanAttrs.js8
-rw-r--r--src/ng/directive/input.js4
-rw-r--r--src/ng/directive/ngBind.js7
-rw-r--r--src/ng/directive/ngClass.js10
-rw-r--r--src/ng/directive/ngCloak.js4
-rw-r--r--src/ng/directive/ngEventDirs.js8
-rw-r--r--src/ng/directive/ngInclude.js4
-rw-r--r--src/ng/directive/ngNonBindable.js2
-rw-r--r--src/ng/directive/ngRepeat.js7
-rw-r--r--src/ng/directive/ngShowHide.js12
-rw-r--r--src/ng/directive/ngStyle.js8
-rw-r--r--src/ng/directive/ngSwitch.js4
-rw-r--r--src/ng/http.js2
-rw-r--r--src/ng/sce.js2
-rw-r--r--src/ngRoute/directive/ngView.js6
-rw-r--r--src/ngRoute/route.js6
16 files changed, 46 insertions, 48 deletions
diff --git a/src/ng/directive/booleanAttrs.js b/src/ng/directive/booleanAttrs.js
index 099bdbbb..01b9ee67 100644
--- a/src/ng/directive/booleanAttrs.js
+++ b/src/ng/directive/booleanAttrs.js
@@ -176,9 +176,9 @@
</file>
<file name="protractor.js" type="protractor">
it('should toggle button', function() {
- expect(element(by.css('.doc-example-live button')).getAttribute('disabled')).toBeFalsy();
+ expect(element(by.css('button')).getAttribute('disabled')).toBeFalsy();
element(by.model('checked')).click();
- expect(element(by.css('.doc-example-live button')).getAttribute('disabled')).toBeTruthy();
+ expect(element(by.css('button')).getAttribute('disabled')).toBeTruthy();
});
</file>
</example>
@@ -246,9 +246,9 @@
</file>
<file name="protractor.js" type="protractor">
it('should toggle readonly attr', function() {
- expect(element(by.css('.doc-example-live [type="text"]')).getAttribute('readonly')).toBeFalsy();
+ expect(element(by.css('[type="text"]')).getAttribute('readonly')).toBeFalsy();
element(by.model('checked')).click();
- expect(element(by.css('.doc-example-live [type="text"]')).getAttribute('readonly')).toBeTruthy();
+ expect(element(by.css('[type="text"]')).getAttribute('readonly')).toBeTruthy();
});
</file>
</example>
diff --git a/src/ng/directive/input.js b/src/ng/directive/input.js
index 676c1692..0410b197 100644
--- a/src/ng/directive/input.js
+++ b/src/ng/directive/input.js
@@ -955,13 +955,13 @@ var VALID_CLASS = 'ng-valid',
<textarea ng-model="userContent"></textarea>
</form>
</file>
- <file name="protractorTest.js">
+ <file name="protractor.js" type="protractor">
it('should data-bind and become invalid', function() {
if (browser.params.browser = 'safari') {
// SafariDriver can't handle contenteditable.
return;
};
- var contentEditable = element(by.css('.doc-example-live [contenteditable]'));
+ var contentEditable = element(by.css('[contenteditable]'));
expect(contentEditable.getText()).toEqual('Change me!');
diff --git a/src/ng/directive/ngBind.js b/src/ng/directive/ngBind.js
index 43611c5a..6bd4fd27 100644
--- a/src/ng/directive/ngBind.js
+++ b/src/ng/directive/ngBind.js
@@ -40,13 +40,12 @@
</file>
<file name="protractor.js" type="protractor">
it('should check ng-bind', function() {
- var exampleContainer = $('.doc-example-live');
var nameInput = element(by.model('name'));
- expect(exampleContainer.findElement(by.binding('name')).getText()).toBe('Whirled');
+ expect(element(by.binding('name')).getText()).toBe('Whirled');
nameInput.clear();
nameInput.sendKeys('world');
- expect(exampleContainer.findElement(by.binding('name')).getText()).toBe('world');
+ expect(element(by.binding('name')).getText()).toBe('world');
});
</file>
</example>
@@ -162,7 +161,7 @@ var ngBindTemplateDirective = ['$interpolate', function($interpolate) {
}]);
</file>
- <file name="protractorTest.js">
+ <file name="protractor.js" type="protractor">
it('should check ng-bind-html', function() {
expect(element(by.binding('myHTML')).getText()).toBe(
'I am an HTMLstring with links! and other stuff');
diff --git a/src/ng/directive/ngClass.js b/src/ng/directive/ngClass.js
index 17ace582..fa6d81b2 100644
--- a/src/ng/directive/ngClass.js
+++ b/src/ng/directive/ngClass.js
@@ -114,8 +114,8 @@ function classDirective(name, selector) {
color: red;
}
</file>
- <file name="protractorTest.js">
- var ps = element.all(by.css('.doc-example-live p'));
+ <file name="protractor.js" type="protractor">
+ var ps = element.all(by.css('p'));
it('should let you toggle the class', function() {
@@ -168,7 +168,7 @@ function classDirective(name, selector) {
font-size:3em;
}
</file>
- <file name="protractorTest.js">
+ <file name="protractor.js" type="protractor">
it('should check ng-class', function() {
expect(element(by.css('.base-class')).getAttribute('class')).not.
toMatch(/my-class/);
@@ -232,7 +232,7 @@ var ngClassDirective = classDirective('', true);
color: blue;
}
</file>
- <file name="protractorTest.js">
+ <file name="protractor.js" type="protractor">
it('should check ng-class-odd and ng-class-even', function() {
expect(element(by.repeater('name in names').row(0).column('name')).getAttribute('class')).
toMatch(/odd/);
@@ -280,7 +280,7 @@ var ngClassOddDirective = classDirective('Odd', 0);
color: blue;
}
</file>
- <file name="protractorTest.js">
+ <file name="protractor.js" type="protractor">
it('should check ng-class-odd and ng-class-even', function() {
expect(element(by.repeater('name in names').row(0).column('name')).getAttribute('class')).
toMatch(/odd/);
diff --git a/src/ng/directive/ngCloak.js b/src/ng/directive/ngCloak.js
index 21a32801..bf19117a 100644
--- a/src/ng/directive/ngCloak.js
+++ b/src/ng/directive/ngCloak.js
@@ -47,9 +47,9 @@
</file>
<file name="protractor.js" type="protractor">
it('should remove the template directive and css class', function() {
- expect($('.doc-example-live #template1').getAttribute('ng-cloak')).
+ expect($('#template1').getAttribute('ng-cloak')).
toBeNull();
- expect($('.doc-example-live #template2').getAttribute('ng-cloak')).
+ expect($('#template2').getAttribute('ng-cloak')).
toBeNull();
});
</file>
diff --git a/src/ng/directive/ngEventDirs.js b/src/ng/directive/ngEventDirs.js
index 6361a309..ea65be90 100644
--- a/src/ng/directive/ngEventDirs.js
+++ b/src/ng/directive/ngEventDirs.js
@@ -24,7 +24,7 @@
<file name="protractor.js" type="protractor">
it('should check ng-click', function() {
expect(element(by.binding('count')).getText()).toMatch('0');
- element(by.css('.doc-example-live button')).click();
+ element(by.css('button')).click();
expect(element(by.binding('count')).getText()).toMatch('1');
});
</file>
@@ -330,14 +330,14 @@ forEach(
<file name="protractor.js" type="protractor">
it('should check ng-submit', function() {
expect(element(by.binding('list')).getText()).toBe('list=[]');
- element(by.css('.doc-example-live #submit')).click();
+ element(by.css('#submit')).click();
expect(element(by.binding('list')).getText()).toContain('hello');
expect(element(by.input('text')).getAttribute('value')).toBe('');
});
it('should ignore empty strings', function() {
expect(element(by.binding('list')).getText()).toBe('list=[]');
- element(by.css('.doc-example-live #submit')).click();
- element(by.css('.doc-example-live #submit')).click();
+ element(by.css('#submit')).click();
+ element(by.css('#submit')).click();
expect(element(by.binding('list')).getText()).toContain('hello');
});
</file>
diff --git a/src/ng/directive/ngInclude.js b/src/ng/directive/ngInclude.js
index 0258c9c5..1d3c7246 100644
--- a/src/ng/directive/ngInclude.js
+++ b/src/ng/directive/ngInclude.js
@@ -110,9 +110,9 @@
top:50px;
}
</file>
- <file name="protractorTest.js">
+ <file name="protractor.js" type="protractor">
var templateSelect = element(by.model('template'));
- var includeElem = element(by.css('.doc-example-live [ng-include]'));
+ var includeElem = element(by.css('[ng-include]'));
it('should load template1.html', function() {
expect(includeElem.getText()).toMatch(/Content of template1.html/);
diff --git a/src/ng/directive/ngNonBindable.js b/src/ng/directive/ngNonBindable.js
index 0fce757c..21c17abe 100644
--- a/src/ng/directive/ngNonBindable.js
+++ b/src/ng/directive/ngNonBindable.js
@@ -27,7 +27,7 @@
<file name="protractor.js" type="protractor">
it('should check ng-non-bindable', function() {
expect(element(by.binding('1 + 2')).getText()).toContain('3');
- expect(element.all(by.css('.doc-example-live div')).last().getText()).toMatch(/1 \+ 2/);
+ expect(element.all(by.css('div')).last().getText()).toMatch(/1 \+ 2/);
});
</file>
</example>
diff --git a/src/ng/directive/ngRepeat.js b/src/ng/directive/ngRepeat.js
index 4fa82de3..d2c2027b 100644
--- a/src/ng/directive/ngRepeat.js
+++ b/src/ng/directive/ngRepeat.js
@@ -172,9 +172,8 @@
max-height:40px;
}
</file>
- <file name="protractorTest.js">
- var friends = element(by.css('.doc-example-live'))
- .element.all(by.repeater('friend in friends'));
+ <file name="protractor.js" type="protractor">
+ var friends = element.all(by.repeater('friend in friends'));
it('should render initial data set', function() {
expect(friends.count()).toBe(10);
@@ -188,7 +187,7 @@
it('should update repeater when filter predicate changes', function() {
expect(friends.count()).toBe(10);
- element(by.css('.doc-example-live')).element(by.model('q')).sendKeys('ma');
+ element(by.model('q')).sendKeys('ma');
expect(friends.count()).toBe(2);
expect(friends.get(0).getText()).toEqual('[1] Mary who is 28 years old.');
diff --git a/src/ng/directive/ngShowHide.js b/src/ng/directive/ngShowHide.js
index a6b47b9c..c22708c5 100644
--- a/src/ng/directive/ngShowHide.js
+++ b/src/ng/directive/ngShowHide.js
@@ -132,9 +132,9 @@
background:white;
}
</file>
- <file name="protractorTest.js">
- var thumbsUp = element(by.css('.doc-example-live span.icon-thumbs-up'));
- var thumbsDown = element(by.css('.doc-example-live span.icon-thumbs-down'));
+ <file name="protractor.js" type="protractor">
+ var thumbsUp = element(by.css('span.icon-thumbs-up'));
+ var thumbsDown = element(by.css('span.icon-thumbs-down'));
it('should check ng-show / ng-hide', function() {
expect(thumbsUp.isDisplayed()).toBeFalsy();
@@ -289,9 +289,9 @@ var ngShowDirective = ['$animate', function($animate) {
background:white;
}
</file>
- <file name="protractorTest.js">
- var thumbsUp = element(by.css('.doc-example-live span.icon-thumbs-up'));
- var thumbsDown = element(by.css('.doc-example-live span.icon-thumbs-down'));
+ <file name="protractor.js" type="protractor">
+ var thumbsUp = element(by.css('span.icon-thumbs-up'));
+ var thumbsDown = element(by.css('span.icon-thumbs-down'));
it('should check ng-show / ng-hide', function() {
expect(thumbsUp.isDisplayed()).toBeFalsy();
diff --git a/src/ng/directive/ngStyle.js b/src/ng/directive/ngStyle.js
index 1722ca77..3a627f8f 100644
--- a/src/ng/directive/ngStyle.js
+++ b/src/ng/directive/ngStyle.js
@@ -27,14 +27,14 @@
color: black;
}
</file>
- <file name="protractorTest.js">
- var colorSpan = element(by.css('.doc-example-live span'));
+ <file name="protractor.js" type="protractor">
+ var colorSpan = element(by.css('span'));
it('should check ng-style', function() {
expect(colorSpan.getCssValue('color')).toBe('rgba(0, 0, 0, 1)');
- element(by.css('.doc-example-live input[value=set]')).click();
+ element(by.css('input[value=set]')).click();
expect(colorSpan.getCssValue('color')).toBe('rgba(255, 0, 0, 1)');
- element(by.css('.doc-example-live input[value=clear]')).click();
+ element(by.css('input[value=clear]')).click();
expect(colorSpan.getCssValue('color')).toBe('rgba(0, 0, 0, 1)');
});
</file>
diff --git a/src/ng/directive/ngSwitch.js b/src/ng/directive/ngSwitch.js
index 0c9d4760..59cef79b 100644
--- a/src/ng/directive/ngSwitch.js
+++ b/src/ng/directive/ngSwitch.js
@@ -107,8 +107,8 @@
top:0;
}
</file>
- <file name="protractorTest.js">
- var switchElem = element(by.css('.doc-example-live [ng-switch]'));
+ <file name="protractor.js" type="protractor">
+ var switchElem = element(by.css('[ng-switch]'));
var select = element(by.model('selection'));
it('should start in settings', function() {
diff --git a/src/ng/http.js b/src/ng/http.js
index 81e46970..81112bde 100644
--- a/src/ng/http.js
+++ b/src/ng/http.js
@@ -631,7 +631,7 @@ function $HttpProvider() {
<file name="http-hello.html">
Hello, $http!
</file>
-<file name="protractorTest.js">
+<file name="protractor.js" type="protractor">
var status = element(by.binding('status'));
var data = element(by.binding('data'));
var fetchBtn = element(by.id('fetchbtn'));
diff --git a/src/ng/sce.js b/src/ng/sce.js
index 248393f6..9eaf9097 100644
--- a/src/ng/sce.js
+++ b/src/ng/sce.js
@@ -619,7 +619,7 @@ function $SceDelegateProvider() {
]
</file>
-<file name="protractorTest.js">
+<file name="protractor.js" type="protractor">
describe('SCE doc demo', function() {
it('should sanitize untrusted values', function() {
expect(element(by.css('.htmlComment')).getInnerHtml())
diff --git a/src/ngRoute/directive/ngView.js b/src/ngRoute/directive/ngView.js
index f61fb121..46812430 100644
--- a/src/ngRoute/directive/ngView.js
+++ b/src/ngRoute/directive/ngView.js
@@ -151,17 +151,17 @@ ngRouteModule.directive('ngView', ngViewFillContentFactory);
}
</file>
- <file name="protractorTest.js">
+ <file name="protractor.js" type="protractor">
it('should load and compile correct template', function() {
element(by.linkText('Moby: Ch1')).click();
- var content = element(by.css('.doc-example-live [ng-view]')).getText();
+ var content = element(by.css('[ng-view]')).getText();
expect(content).toMatch(/controller\: ChapterCntl/);
expect(content).toMatch(/Book Id\: Moby/);
expect(content).toMatch(/Chapter Id\: 1/);
element(by.partialLinkText('Scarlet')).click();
- content = element(by.css('.doc-example-live [ng-view]')).getText();
+ content = element(by.css('[ng-view]')).getText();
expect(content).toMatch(/controller\: BookCntl/);
expect(content).toMatch(/Book Id\: Scarlet/);
});
diff --git a/src/ngRoute/route.js b/src/ngRoute/route.js
index 17fea641..3661722f 100644
--- a/src/ngRoute/route.js
+++ b/src/ngRoute/route.js
@@ -343,17 +343,17 @@ function $RouteProvider(){
}
</file>
- <file name="protractorTest.js">
+ <file name="protractor.js" type="protractor">
it('should load and compile correct template', function() {
element(by.linkText('Moby: Ch1')).click();
- var content = element(by.css('.doc-example-live [ng-view]')).getText();
+ var content = element(by.css('[ng-view]')).getText();
expect(content).toMatch(/controller\: ChapterCntl/);
expect(content).toMatch(/Book Id\: Moby/);
expect(content).toMatch(/Chapter Id\: 1/);
element(by.partialLinkText('Scarlet')).click();
- content = element(by.css('.doc-example-live [ng-view]')).getText();
+ content = element(by.css('[ng-view]')).getText();
expect(content).toMatch(/controller\: BookCntl/);
expect(content).toMatch(/Book Id\: Scarlet/);
});