Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

Commit 2ab0d5d

Browse files
petebacondarwinvojtajina
authored andcommitted
test(e2e): fix by.binding() locators
After upgrading, Protractor requires exact string that is used in the binding.
1 parent ac68ee4 commit 2ab0d5d

File tree

6 files changed

+49
-49
lines changed

6 files changed

+49
-49
lines changed

docs/content/guide/$location.ngdoc

Lines changed: 36 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -469,12 +469,12 @@ In these examples we use `<base href="/base/index.html" />`
469469
it("should show fake browser info on load", function(){
470470
expect(addressBar.getAttribute('value')).toBe(url);
471471

472-
expect(element(by.binding('$location.protocol')).getText()).toBe('http');
473-
expect(element(by.binding('$location.host')).getText()).toBe('www.example.com');
474-
expect(element(by.binding('$location.port')).getText()).toBe('80');
475-
expect(element(by.binding('$location.path')).getText()).toBe('/path');
476-
expect(element(by.binding('$location.search')).getText()).toBe('{"a":"b"}');
477-
expect(element(by.binding('$location.hash')).getText()).toBe('h');
472+
expect(element(by.binding('$location.protocol()')).getText()).toBe('http');
473+
expect(element(by.binding('$location.host()')).getText()).toBe('www.example.com');
474+
expect(element(by.binding('$location.port()')).getText()).toBe('80');
475+
expect(element(by.binding('$location.path()')).getText()).toBe('/path');
476+
expect(element(by.binding('$location.search()')).getText()).toBe('{"a":"b"}');
477+
expect(element(by.binding('$location.hash()')).getText()).toBe('h');
478478

479479
});
480480

@@ -485,24 +485,24 @@ In these examples we use `<base href="/base/index.html" />`
485485

486486
expect(addressBar.getAttribute('value')).toBe("http://www.example.com/base/first?a=b");
487487

488-
expect(element(by.binding('$location.protocol')).getText()).toBe('http');
489-
expect(element(by.binding('$location.host')).getText()).toBe('www.example.com');
490-
expect(element(by.binding('$location.port')).getText()).toBe('80');
491-
expect(element(by.binding('$location.path')).getText()).toBe('/first');
492-
expect(element(by.binding('$location.search')).getText()).toBe('{"a":"b"}');
493-
expect(element(by.binding('$location.hash')).getText()).toBe('');
488+
expect(element(by.binding('$location.protocol()')).getText()).toBe('http');
489+
expect(element(by.binding('$location.host()')).getText()).toBe('www.example.com');
490+
expect(element(by.binding('$location.port()')).getText()).toBe('80');
491+
expect(element(by.binding('$location.path()')).getText()).toBe('/first');
492+
expect(element(by.binding('$location.search()')).getText()).toBe('{"a":"b"}');
493+
expect(element(by.binding('$location.hash()')).getText()).toBe('');
494494

495495

496496
navigation.get(1).click();
497497

498498
expect(addressBar.getAttribute('value')).toBe("http://www.example.com/base/sec/ond?flag#hash");
499499

500-
expect(element(by.binding('$location.protocol')).getText()).toBe('http');
501-
expect(element(by.binding('$location.host')).getText()).toBe('www.example.com');
502-
expect(element(by.binding('$location.port')).getText()).toBe('80');
503-
expect(element(by.binding('$location.path')).getText()).toBe('/sec/ond');
504-
expect(element(by.binding('$location.search')).getText()).toBe('{"flag":true}');
505-
expect(element(by.binding('$location.hash')).getText()).toBe('hash');
500+
expect(element(by.binding('$location.protocol()')).getText()).toBe('http');
501+
expect(element(by.binding('$location.host()')).getText()).toBe('www.example.com');
502+
expect(element(by.binding('$location.port()')).getText()).toBe('80');
503+
expect(element(by.binding('$location.path()')).getText()).toBe('/sec/ond');
504+
expect(element(by.binding('$location.search()')).getText()).toBe('{"flag":true}');
505+
expect(element(by.binding('$location.hash()')).getText()).toBe('hash');
506506
});
507507

508508
</file>
@@ -621,12 +621,12 @@ In these examples we use `<base href="/base/index.html" />`
621621
it("should show fake browser info on load", function(){
622622
expect(addressBar.getAttribute('value')).toBe(url);
623623

624-
expect(element(by.binding('$location.protocol')).getText()).toBe('http');
625-
expect(element(by.binding('$location.host')).getText()).toBe('www.example.com');
626-
expect(element(by.binding('$location.port')).getText()).toBe('80');
627-
expect(element(by.binding('$location.path')).getText()).toBe('/path');
628-
expect(element(by.binding('$location.search')).getText()).toBe('{"a":"b"}');
629-
expect(element(by.binding('$location.hash')).getText()).toBe('h');
624+
expect(element(by.binding('$location.protocol()')).getText()).toBe('http');
625+
expect(element(by.binding('$location.host()')).getText()).toBe('www.example.com');
626+
expect(element(by.binding('$location.port()')).getText()).toBe('80');
627+
expect(element(by.binding('$location.path()')).getText()).toBe('/path');
628+
expect(element(by.binding('$location.search()')).getText()).toBe('{"a":"b"}');
629+
expect(element(by.binding('$location.hash()')).getText()).toBe('h');
630630

631631
});
632632

@@ -637,24 +637,24 @@ In these examples we use `<base href="/base/index.html" />`
637637

638638
expect(addressBar.getAttribute('value')).toBe("http://www.example.com/base/index.html#!/first?a=b");
639639

640-
expect(element(by.binding('$location.protocol')).getText()).toBe('http');
641-
expect(element(by.binding('$location.host')).getText()).toBe('www.example.com');
642-
expect(element(by.binding('$location.port')).getText()).toBe('80');
643-
expect(element(by.binding('$location.path')).getText()).toBe('/first');
644-
expect(element(by.binding('$location.search')).getText()).toBe('{"a":"b"}');
645-
expect(element(by.binding('$location.hash')).getText()).toBe('');
640+
expect(element(by.binding('$location.protocol()')).getText()).toBe('http');
641+
expect(element(by.binding('$location.host()')).getText()).toBe('www.example.com');
642+
expect(element(by.binding('$location.port()')).getText()).toBe('80');
643+
expect(element(by.binding('$location.path()')).getText()).toBe('/first');
644+
expect(element(by.binding('$location.search()')).getText()).toBe('{"a":"b"}');
645+
expect(element(by.binding('$location.hash()')).getText()).toBe('');
646646

647647

648648
navigation.get(1).click();
649649

650650
expect(addressBar.getAttribute('value')).toBe("http://www.example.com/base/index.html#!/sec/ond?flag#hash");
651651

652-
expect(element(by.binding('$location.protocol')).getText()).toBe('http');
653-
expect(element(by.binding('$location.host')).getText()).toBe('www.example.com');
654-
expect(element(by.binding('$location.port')).getText()).toBe('80');
655-
expect(element(by.binding('$location.path')).getText()).toBe('/sec/ond');
656-
expect(element(by.binding('$location.search')).getText()).toBe('{"flag":true}');
657-
expect(element(by.binding('$location.hash')).getText()).toBe('hash');
652+
expect(element(by.binding('$location.protocol()')).getText()).toBe('http');
653+
expect(element(by.binding('$location.host()')).getText()).toBe('www.example.com');
654+
expect(element(by.binding('$location.port()')).getText()).toBe('80');
655+
expect(element(by.binding('$location.path()')).getText()).toBe('/sec/ond');
656+
expect(element(by.binding('$location.search()')).getText()).toBe('{"flag":true}');
657+
expect(element(by.binding('$location.hash()')).getText()).toBe('hash');
658658

659659
});
660660
</file>

docs/content/guide/module.ngdoc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ I'm in a hurry. How do I get a Hello World module working?
5050

5151
<file name="protractor.js" type="protractor">
5252
it('should add Hello to the name', function() {
53-
expect(element(by.binding("{{ 'World' | greet }}")).getText()).toEqual('Hello, World!');
53+
expect(element(by.binding(" 'World' | greet ")).getText()).toEqual('Hello, World!');
5454
});
5555
</file>
5656
</example>
@@ -128,7 +128,7 @@ The above is a suggestion. Tailor it to your needs.
128128

129129
<file name="protractor.js" type="protractor">
130130
it('should add Hello to the name', function() {
131-
expect(element(by.binding("{{ greeting }}")).getText()).toEqual('Bonjour World!');
131+
expect(element(by.binding(" greeting ")).getText()).toEqual('Bonjour World!');
132132
});
133133
</file>
134134

src/ng/directive/input.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -814,7 +814,7 @@ var inputType = {
814814
</file>
815815
<file name="protractor.js" type="protractor">
816816
it('should change state', function() {
817-
var color = element(by.binding('color'));
817+
var color = element(by.binding('color | json'));
818818
819819
expect(color.getText()).toContain('blue');
820820
@@ -1313,7 +1313,7 @@ function checkboxInputType(scope, element, attr, ctrl, $sniffer, $browser, $filt
13131313
</div>
13141314
</file>
13151315
<file name="protractor.js" type="protractor">
1316-
var user = element(by.binding('{{user}}'));
1316+
var user = element(by.binding('user'));
13171317
var userNameValid = element(by.binding('myForm.userName.$valid'));
13181318
var lastNameValid = element(by.binding('myForm.lastName.$valid'));
13191319
var lastNameError = element(by.binding('myForm.lastName.$error'));
@@ -2542,7 +2542,7 @@ var minlengthDirective = function() {
25422542
* </file>
25432543
* <file name="protractor.js" type="protractor">
25442544
* var listInput = element(by.model('names'));
2545-
* var names = element(by.binding('{{names}}'));
2545+
* var names = element(by.binding('names'));
25462546
* var valid = element(by.binding('myForm.namesInput.$valid'));
25472547
* var error = element(by.css('span.error'));
25482548
*
@@ -2572,7 +2572,7 @@ var minlengthDirective = function() {
25722572
* <file name="protractor.js" type="protractor">
25732573
* it("should split the text by newlines", function() {
25742574
* var listInput = element(by.model('list'));
2575-
* var output = element(by.binding('{{ list | json }}'));
2575+
* var output = element(by.binding(' list | json '));
25762576
* listInput.sendKeys('abc\ndef\nghi');
25772577
* expect(output.getText()).toContain('[\n "abc",\n "def",\n "ghi"\n]');
25782578
* });

src/ng/directive/select.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -115,21 +115,21 @@ var ngOptionsMinErr = minErr('ngOptions');
115115
116116
Select <a href ng-click="myColor = { name:'not in list', shade: 'other' }">bogus</a>.<br>
117117
<hr/>
118-
Currently selected: {{ {selected_color:myColor} }}
118+
Currently selected: {{ {selected_color:myColor} }}
119119
<div style="border:solid 1px black; height:20px"
120120
ng-style="{'background-color':myColor.name}">
121121
</div>
122122
</div>
123123
</file>
124124
<file name="protractor.js" type="protractor">
125125
it('should check ng-options', function() {
126-
expect(element(by.binding('{selected_color:myColor}')).getText()).toMatch('red');
126+
expect(element(by.binding(' {selected_color:myColor} ')).getText()).toMatch('red');
127127
element.all(by.model('myColor')).first().click();
128128
element.all(by.css('select[ng-model="myColor"] option')).first().click();
129-
expect(element(by.binding('{selected_color:myColor}')).getText()).toMatch('black');
129+
expect(element(by.binding(' {selected_color:myColor} ')).getText()).toMatch('black');
130130
element(by.css('.nullable select[ng-model="myColor"]')).click();
131131
element.all(by.css('.nullable select[ng-model="myColor"] option')).first().click();
132-
expect(element(by.binding('{selected_color:myColor}')).getText()).toMatch('null');
132+
expect(element(by.binding(' {selected_color:myColor} ')).getText()).toMatch('null');
133133
});
134134
</file>
135135
</example>

src/ng/filter/filters.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -490,7 +490,7 @@ function dateFilter($locale) {
490490
</file>
491491
<file name="protractor.js" type="protractor">
492492
it('should jsonify filtered objects', function() {
493-
expect(element(by.binding("{'name':'value'}")).getText()).toMatch(/\{\n "name": ?"value"\n}/);
493+
expect(element(by.binding(" {'name':'value'} | json ")).getText()).toMatch(/\{\n "name": ?"value"\n}/);
494494
});
495495
</file>
496496
</example>

src/ng/filter/limitTo.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,8 @@
4040
<file name="protractor.js" type="protractor">
4141
var numLimitInput = element(by.model('numLimit'));
4242
var letterLimitInput = element(by.model('letterLimit'));
43-
var limitedNumbers = element(by.binding('numbers | limitTo:numLimit'));
44-
var limitedLetters = element(by.binding('letters | limitTo:letterLimit'));
43+
var limitedNumbers = element(by.binding(' numbers | limitTo:numLimit '));
44+
var limitedLetters = element(by.binding(' letters | limitTo:letterLimit '));
4545
4646
it('should limit the number array to first three items', function() {
4747
expect(numLimitInput.getAttribute('value')).toBe('3');

0 commit comments

Comments
 (0)