mirror of
https://github.com/zhigang1992/angular.js.git
synced 2026-06-18 12:14:04 +08:00
test(e2e): fix by.binding() locators
After upgrading, Protractor requires exact string that is used in the binding.
This commit is contained in:
committed by
Vojta Jina
parent
ac68ee49c1
commit
2ab0d5d370
@@ -469,12 +469,12 @@ In these examples we use `<base href="/base/index.html" />`
|
||||
it("should show fake browser info on load", function(){
|
||||
expect(addressBar.getAttribute('value')).toBe(url);
|
||||
|
||||
expect(element(by.binding('$location.protocol')).getText()).toBe('http');
|
||||
expect(element(by.binding('$location.host')).getText()).toBe('www.example.com');
|
||||
expect(element(by.binding('$location.port')).getText()).toBe('80');
|
||||
expect(element(by.binding('$location.path')).getText()).toBe('/path');
|
||||
expect(element(by.binding('$location.search')).getText()).toBe('{"a":"b"}');
|
||||
expect(element(by.binding('$location.hash')).getText()).toBe('h');
|
||||
expect(element(by.binding('$location.protocol()')).getText()).toBe('http');
|
||||
expect(element(by.binding('$location.host()')).getText()).toBe('www.example.com');
|
||||
expect(element(by.binding('$location.port()')).getText()).toBe('80');
|
||||
expect(element(by.binding('$location.path()')).getText()).toBe('/path');
|
||||
expect(element(by.binding('$location.search()')).getText()).toBe('{"a":"b"}');
|
||||
expect(element(by.binding('$location.hash()')).getText()).toBe('h');
|
||||
|
||||
});
|
||||
|
||||
@@ -485,24 +485,24 @@ In these examples we use `<base href="/base/index.html" />`
|
||||
|
||||
expect(addressBar.getAttribute('value')).toBe("http://www.example.com/base/first?a=b");
|
||||
|
||||
expect(element(by.binding('$location.protocol')).getText()).toBe('http');
|
||||
expect(element(by.binding('$location.host')).getText()).toBe('www.example.com');
|
||||
expect(element(by.binding('$location.port')).getText()).toBe('80');
|
||||
expect(element(by.binding('$location.path')).getText()).toBe('/first');
|
||||
expect(element(by.binding('$location.search')).getText()).toBe('{"a":"b"}');
|
||||
expect(element(by.binding('$location.hash')).getText()).toBe('');
|
||||
expect(element(by.binding('$location.protocol()')).getText()).toBe('http');
|
||||
expect(element(by.binding('$location.host()')).getText()).toBe('www.example.com');
|
||||
expect(element(by.binding('$location.port()')).getText()).toBe('80');
|
||||
expect(element(by.binding('$location.path()')).getText()).toBe('/first');
|
||||
expect(element(by.binding('$location.search()')).getText()).toBe('{"a":"b"}');
|
||||
expect(element(by.binding('$location.hash()')).getText()).toBe('');
|
||||
|
||||
|
||||
navigation.get(1).click();
|
||||
|
||||
expect(addressBar.getAttribute('value')).toBe("http://www.example.com/base/sec/ond?flag#hash");
|
||||
|
||||
expect(element(by.binding('$location.protocol')).getText()).toBe('http');
|
||||
expect(element(by.binding('$location.host')).getText()).toBe('www.example.com');
|
||||
expect(element(by.binding('$location.port')).getText()).toBe('80');
|
||||
expect(element(by.binding('$location.path')).getText()).toBe('/sec/ond');
|
||||
expect(element(by.binding('$location.search')).getText()).toBe('{"flag":true}');
|
||||
expect(element(by.binding('$location.hash')).getText()).toBe('hash');
|
||||
expect(element(by.binding('$location.protocol()')).getText()).toBe('http');
|
||||
expect(element(by.binding('$location.host()')).getText()).toBe('www.example.com');
|
||||
expect(element(by.binding('$location.port()')).getText()).toBe('80');
|
||||
expect(element(by.binding('$location.path()')).getText()).toBe('/sec/ond');
|
||||
expect(element(by.binding('$location.search()')).getText()).toBe('{"flag":true}');
|
||||
expect(element(by.binding('$location.hash()')).getText()).toBe('hash');
|
||||
});
|
||||
|
||||
</file>
|
||||
@@ -621,12 +621,12 @@ In these examples we use `<base href="/base/index.html" />`
|
||||
it("should show fake browser info on load", function(){
|
||||
expect(addressBar.getAttribute('value')).toBe(url);
|
||||
|
||||
expect(element(by.binding('$location.protocol')).getText()).toBe('http');
|
||||
expect(element(by.binding('$location.host')).getText()).toBe('www.example.com');
|
||||
expect(element(by.binding('$location.port')).getText()).toBe('80');
|
||||
expect(element(by.binding('$location.path')).getText()).toBe('/path');
|
||||
expect(element(by.binding('$location.search')).getText()).toBe('{"a":"b"}');
|
||||
expect(element(by.binding('$location.hash')).getText()).toBe('h');
|
||||
expect(element(by.binding('$location.protocol()')).getText()).toBe('http');
|
||||
expect(element(by.binding('$location.host()')).getText()).toBe('www.example.com');
|
||||
expect(element(by.binding('$location.port()')).getText()).toBe('80');
|
||||
expect(element(by.binding('$location.path()')).getText()).toBe('/path');
|
||||
expect(element(by.binding('$location.search()')).getText()).toBe('{"a":"b"}');
|
||||
expect(element(by.binding('$location.hash()')).getText()).toBe('h');
|
||||
|
||||
});
|
||||
|
||||
@@ -637,24 +637,24 @@ In these examples we use `<base href="/base/index.html" />`
|
||||
|
||||
expect(addressBar.getAttribute('value')).toBe("http://www.example.com/base/index.html#!/first?a=b");
|
||||
|
||||
expect(element(by.binding('$location.protocol')).getText()).toBe('http');
|
||||
expect(element(by.binding('$location.host')).getText()).toBe('www.example.com');
|
||||
expect(element(by.binding('$location.port')).getText()).toBe('80');
|
||||
expect(element(by.binding('$location.path')).getText()).toBe('/first');
|
||||
expect(element(by.binding('$location.search')).getText()).toBe('{"a":"b"}');
|
||||
expect(element(by.binding('$location.hash')).getText()).toBe('');
|
||||
expect(element(by.binding('$location.protocol()')).getText()).toBe('http');
|
||||
expect(element(by.binding('$location.host()')).getText()).toBe('www.example.com');
|
||||
expect(element(by.binding('$location.port()')).getText()).toBe('80');
|
||||
expect(element(by.binding('$location.path()')).getText()).toBe('/first');
|
||||
expect(element(by.binding('$location.search()')).getText()).toBe('{"a":"b"}');
|
||||
expect(element(by.binding('$location.hash()')).getText()).toBe('');
|
||||
|
||||
|
||||
navigation.get(1).click();
|
||||
|
||||
expect(addressBar.getAttribute('value')).toBe("http://www.example.com/base/index.html#!/sec/ond?flag#hash");
|
||||
|
||||
expect(element(by.binding('$location.protocol')).getText()).toBe('http');
|
||||
expect(element(by.binding('$location.host')).getText()).toBe('www.example.com');
|
||||
expect(element(by.binding('$location.port')).getText()).toBe('80');
|
||||
expect(element(by.binding('$location.path')).getText()).toBe('/sec/ond');
|
||||
expect(element(by.binding('$location.search')).getText()).toBe('{"flag":true}');
|
||||
expect(element(by.binding('$location.hash')).getText()).toBe('hash');
|
||||
expect(element(by.binding('$location.protocol()')).getText()).toBe('http');
|
||||
expect(element(by.binding('$location.host()')).getText()).toBe('www.example.com');
|
||||
expect(element(by.binding('$location.port()')).getText()).toBe('80');
|
||||
expect(element(by.binding('$location.path()')).getText()).toBe('/sec/ond');
|
||||
expect(element(by.binding('$location.search()')).getText()).toBe('{"flag":true}');
|
||||
expect(element(by.binding('$location.hash()')).getText()).toBe('hash');
|
||||
|
||||
});
|
||||
</file>
|
||||
|
||||
@@ -50,7 +50,7 @@ I'm in a hurry. How do I get a Hello World module working?
|
||||
|
||||
<file name="protractor.js" type="protractor">
|
||||
it('should add Hello to the name', function() {
|
||||
expect(element(by.binding("{{ 'World' | greet }}")).getText()).toEqual('Hello, World!');
|
||||
expect(element(by.binding(" 'World' | greet ")).getText()).toEqual('Hello, World!');
|
||||
});
|
||||
</file>
|
||||
</example>
|
||||
@@ -128,7 +128,7 @@ The above is a suggestion. Tailor it to your needs.
|
||||
|
||||
<file name="protractor.js" type="protractor">
|
||||
it('should add Hello to the name', function() {
|
||||
expect(element(by.binding("{{ greeting }}")).getText()).toEqual('Bonjour World!');
|
||||
expect(element(by.binding(" greeting ")).getText()).toEqual('Bonjour World!');
|
||||
});
|
||||
</file>
|
||||
|
||||
|
||||
@@ -814,7 +814,7 @@ var inputType = {
|
||||
</file>
|
||||
<file name="protractor.js" type="protractor">
|
||||
it('should change state', function() {
|
||||
var color = element(by.binding('color'));
|
||||
var color = element(by.binding('color | json'));
|
||||
|
||||
expect(color.getText()).toContain('blue');
|
||||
|
||||
@@ -1313,7 +1313,7 @@ function checkboxInputType(scope, element, attr, ctrl, $sniffer, $browser, $filt
|
||||
</div>
|
||||
</file>
|
||||
<file name="protractor.js" type="protractor">
|
||||
var user = element(by.binding('{{user}}'));
|
||||
var user = element(by.binding('user'));
|
||||
var userNameValid = element(by.binding('myForm.userName.$valid'));
|
||||
var lastNameValid = element(by.binding('myForm.lastName.$valid'));
|
||||
var lastNameError = element(by.binding('myForm.lastName.$error'));
|
||||
@@ -2542,7 +2542,7 @@ var minlengthDirective = function() {
|
||||
* </file>
|
||||
* <file name="protractor.js" type="protractor">
|
||||
* var listInput = element(by.model('names'));
|
||||
* var names = element(by.binding('{{names}}'));
|
||||
* var names = element(by.binding('names'));
|
||||
* var valid = element(by.binding('myForm.namesInput.$valid'));
|
||||
* var error = element(by.css('span.error'));
|
||||
*
|
||||
@@ -2572,7 +2572,7 @@ var minlengthDirective = function() {
|
||||
* <file name="protractor.js" type="protractor">
|
||||
* it("should split the text by newlines", function() {
|
||||
* var listInput = element(by.model('list'));
|
||||
* var output = element(by.binding('{{ list | json }}'));
|
||||
* var output = element(by.binding(' list | json '));
|
||||
* listInput.sendKeys('abc\ndef\nghi');
|
||||
* expect(output.getText()).toContain('[\n "abc",\n "def",\n "ghi"\n]');
|
||||
* });
|
||||
|
||||
@@ -115,7 +115,7 @@ var ngOptionsMinErr = minErr('ngOptions');
|
||||
|
||||
Select <a href ng-click="myColor = { name:'not in list', shade: 'other' }">bogus</a>.<br>
|
||||
<hr/>
|
||||
Currently selected: {{ {selected_color:myColor} }}
|
||||
Currently selected: {{ {selected_color:myColor} }}
|
||||
<div style="border:solid 1px black; height:20px"
|
||||
ng-style="{'background-color':myColor.name}">
|
||||
</div>
|
||||
@@ -123,13 +123,13 @@ var ngOptionsMinErr = minErr('ngOptions');
|
||||
</file>
|
||||
<file name="protractor.js" type="protractor">
|
||||
it('should check ng-options', function() {
|
||||
expect(element(by.binding('{selected_color:myColor}')).getText()).toMatch('red');
|
||||
expect(element(by.binding(' {selected_color:myColor} ')).getText()).toMatch('red');
|
||||
element.all(by.model('myColor')).first().click();
|
||||
element.all(by.css('select[ng-model="myColor"] option')).first().click();
|
||||
expect(element(by.binding('{selected_color:myColor}')).getText()).toMatch('black');
|
||||
expect(element(by.binding(' {selected_color:myColor} ')).getText()).toMatch('black');
|
||||
element(by.css('.nullable select[ng-model="myColor"]')).click();
|
||||
element.all(by.css('.nullable select[ng-model="myColor"] option')).first().click();
|
||||
expect(element(by.binding('{selected_color:myColor}')).getText()).toMatch('null');
|
||||
expect(element(by.binding(' {selected_color:myColor} ')).getText()).toMatch('null');
|
||||
});
|
||||
</file>
|
||||
</example>
|
||||
|
||||
@@ -490,7 +490,7 @@ function dateFilter($locale) {
|
||||
</file>
|
||||
<file name="protractor.js" type="protractor">
|
||||
it('should jsonify filtered objects', function() {
|
||||
expect(element(by.binding("{'name':'value'}")).getText()).toMatch(/\{\n "name": ?"value"\n}/);
|
||||
expect(element(by.binding(" {'name':'value'} | json ")).getText()).toMatch(/\{\n "name": ?"value"\n}/);
|
||||
});
|
||||
</file>
|
||||
</example>
|
||||
|
||||
@@ -40,8 +40,8 @@
|
||||
<file name="protractor.js" type="protractor">
|
||||
var numLimitInput = element(by.model('numLimit'));
|
||||
var letterLimitInput = element(by.model('letterLimit'));
|
||||
var limitedNumbers = element(by.binding('numbers | limitTo:numLimit'));
|
||||
var limitedLetters = element(by.binding('letters | limitTo:letterLimit'));
|
||||
var limitedNumbers = element(by.binding(' numbers | limitTo:numLimit '));
|
||||
var limitedLetters = element(by.binding(' letters | limitTo:letterLimit '));
|
||||
|
||||
it('should limit the number array to first three items', function() {
|
||||
expect(numLimitInput.getAttribute('value')).toBe('3');
|
||||
|
||||
Reference in New Issue
Block a user