Skip to content

Commit ee4329b

Browse files
test(*): fix e2e bindings
1 parent 9387fae commit ee4329b

File tree

6 files changed

+50
-49
lines changed

6 files changed

+50
-49
lines changed

docs/content/guide/$location.ngdoc

+36-36
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

+2-2
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

+4-4
Original file line numberDiff line numberDiff line change
@@ -798,7 +798,7 @@ var inputType = {
798798
</file>
799799
<file name="protractor.js" type="protractor">
800800
it('should change state', function() {
801-
var color = element(by.binding('color'));
801+
var color = element(by.binding('color | json'));
802802
803803
expect(color.getText()).toContain('blue');
804804
@@ -1334,7 +1334,7 @@ function checkboxInputType(scope, element, attr, ctrl, $sniffer, $browser, $filt
13341334
</div>
13351335
</file>
13361336
<file name="protractor.js" type="protractor">
1337-
var user = element(by.binding('{{user}}'));
1337+
var user = element(by.binding('user'));
13381338
var userNameValid = element(by.binding('myForm.userName.$valid'));
13391339
var lastNameValid = element(by.binding('myForm.lastName.$valid'));
13401340
var lastNameError = element(by.binding('myForm.lastName.$error'));
@@ -2414,7 +2414,7 @@ var minlengthDirective = function() {
24142414
* </file>
24152415
* <file name="protractor.js" type="protractor">
24162416
* var listInput = element(by.model('names'));
2417-
* var names = element(by.binding('{{names}}'));
2417+
* var names = element(by.binding('names'));
24182418
* var valid = element(by.binding('myForm.namesInput.$valid'));
24192419
* var error = element(by.css('span.error'));
24202420
*
@@ -2444,7 +2444,7 @@ var minlengthDirective = function() {
24442444
* <file name="protractor.js" type="protractor">
24452445
* it("should split the text by newlines", function() {
24462446
* var listInput = element(by.model('list'));
2447-
* var output = element(by.binding('{{ list | json }}'));
2447+
* var output = element(by.binding(' list | json '));
24482448
* listInput.sendKeys('abc\ndef\nghi');
24492449
* expect(output.getText()).toContain('[\n "abc",\n "def",\n "ghi"\n]');
24502450
* });

src/ng/directive/select.js

+5-4
Original file line numberDiff line numberDiff line change
@@ -115,21 +115,22 @@ 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: <span id="x">{{ {selected_color:myColor} }}</span>
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+
var selectedColor = element(by.binding(' {selected_color:myColor} '));
127+
expect(selectedColor.getText()).toMatch('red');
127128
element.all(by.model('myColor')).first().click();
128129
element.all(by.css('select[ng-model="myColor"] option')).first().click();
129-
expect(element(by.binding('{selected_color:myColor}')).getText()).toMatch('black');
130+
expect(selectedColor.getText()).toMatch('black');
130131
element(by.css('.nullable select[ng-model="myColor"]')).click();
131132
element.all(by.css('.nullable select[ng-model="myColor"] option')).first().click();
132-
expect(element(by.binding('{selected_color:myColor}')).getText()).toMatch('null');
133+
expect(selectedColor.getText()).toMatch('null');
133134
});
134135
</file>
135136
</example>

src/ng/filter/filters.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -480,7 +480,7 @@ function dateFilter($locale) {
480480
</file>
481481
<file name="protractor.js" type="protractor">
482482
it('should jsonify filtered objects', function() {
483-
expect(element(by.binding("{'name':'value'}")).getText()).toMatch(/\{\n "name": ?"value"\n}/);
483+
expect(element(by.binding(" {'name':'value'} | json ")).getText()).toMatch(/\{\n "name": ?"value"\n}/);
484484
});
485485
</file>
486486
</example>

src/ng/filter/limitTo.js

+2-2
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)