mirror of
https://github.com/Hopiu/angular.js.git
synced 2026-03-16 23:30:23 +00:00
fixing broken e2e tests
This commit is contained in:
parent
a01aa7055c
commit
5bf7ff5a3e
7 changed files with 59 additions and 59 deletions
|
|
@ -68,14 +68,14 @@ angular.formatter('reverse', {
|
|||
</doc:source>
|
||||
<doc:scenario>
|
||||
it('should store reverse', function(){
|
||||
expect(element('.doc-example input:first').val()).toEqual('angular');
|
||||
expect(element('.doc-example input:last').val()).toEqual('RALUGNA');
|
||||
expect(element('.doc-example-live input:first').val()).toEqual('angular');
|
||||
expect(element('.doc-example-live input:last').val()).toEqual('RALUGNA');
|
||||
|
||||
this.addFutureAction('change to XYZ', function($window, $document, done){
|
||||
$document.elements('.doc-example input:last').val('XYZ').trigger('change');
|
||||
$document.elements('.doc-example-live input:last').val('XYZ').trigger('change');
|
||||
done();
|
||||
});
|
||||
expect(element('.doc-example input:first').val()).toEqual('zyx');
|
||||
expect(element('.doc-example-live input:first').val()).toEqual('zyx');
|
||||
});
|
||||
</doc:scenario>
|
||||
</doc:example>
|
||||
|
|
|
|||
|
|
@ -63,7 +63,7 @@ easier life can be with angular:
|
|||
<tr><td>Quantity</td><td>Cost</td></tr>
|
||||
<tr>
|
||||
<td><input name="qty" value="1" ng:validate="integer:0" ng:required/></td>
|
||||
<td><input name="cost" value="199.95" ng:validate="number" ng:required/></td>
|
||||
<td><input name="cost" value="19.95" ng:validate="number" ng:required/></td>
|
||||
</tr>
|
||||
</table>
|
||||
<hr>
|
||||
|
|
|
|||
|
|
@ -562,14 +562,14 @@ function isLeafNode (node) {
|
|||
* </doc:source>
|
||||
* <doc:scenario>
|
||||
it('should print that initialy the form object is NOT equal to master', function() {
|
||||
expect(element('.doc-example input[name=master.salutation]').val()).toBe('Hello');
|
||||
expect(element('.doc-example input[name=master.name]').val()).toBe('world');
|
||||
expect(element('.doc-example span').css('display')).toBe('inline');
|
||||
expect(element('.doc-example-live input[name=master.salutation]').val()).toBe('Hello');
|
||||
expect(element('.doc-example-live input[name=master.name]').val()).toBe('world');
|
||||
expect(element('.doc-example-live span').css('display')).toBe('inline');
|
||||
});
|
||||
|
||||
it('should make form and master equal when the copy button is clicked', function() {
|
||||
element('.doc-example button').click();
|
||||
expect(element('.doc-example span').css('display')).toBe('none');
|
||||
element('.doc-example-live button').click();
|
||||
expect(element('.doc-example-live span').css('display')).toBe('none');
|
||||
});
|
||||
* </doc:scenario>
|
||||
* </doc:example>
|
||||
|
|
@ -643,14 +643,14 @@ function copy(source, destination){
|
|||
* </doc:source>
|
||||
* <doc:scenario>
|
||||
it('should print that initialy greeting is equal to the hardcoded value object', function() {
|
||||
expect(element('.doc-example input[name=greeting.salutation]').val()).toBe('Hello');
|
||||
expect(element('.doc-example input[name=greeting.name]').val()).toBe('world');
|
||||
expect(element('.doc-example span').css('display')).toBe('none');
|
||||
expect(element('.doc-example-live input[name=greeting.salutation]').val()).toBe('Hello');
|
||||
expect(element('.doc-example-live input[name=greeting.name]').val()).toBe('world');
|
||||
expect(element('.doc-example-live span').css('display')).toBe('none');
|
||||
});
|
||||
|
||||
it('should say that the objects are not equal when the form is modified', function() {
|
||||
input('greeting.name').enter('kitty');
|
||||
expect(element('.doc-example span').css('display')).toBe('inline');
|
||||
expect(element('.doc-example-live span').css('display')).toBe('inline');
|
||||
});
|
||||
* </doc:scenario>
|
||||
* </doc:example>
|
||||
|
|
|
|||
46
src/apis.js
46
src/apis.js
|
|
@ -151,7 +151,7 @@ var angularArray = {
|
|||
});
|
||||
|
||||
it('should add an entry and recalculate', function() {
|
||||
element('.doc-example a:contains("add item")').click();
|
||||
element('.doc-example-live a:contains("add item")').click();
|
||||
using('.doc-example-live tr:nth-child(3)').input('item.qty').enter('20');
|
||||
using('.doc-example-live tr:nth-child(3)').input('item.cost').enter('100');
|
||||
|
||||
|
|
@ -206,20 +206,20 @@ var angularArray = {
|
|||
</doc:source>
|
||||
<doc:scenario>
|
||||
it('should initialize the task list with for tasks', function() {
|
||||
expect(repeater('.doc-example ul li', 'task in tasks').count()).toBe(4);
|
||||
expect(repeater('.doc-example ul li', 'task in tasks').column('task')).
|
||||
expect(repeater('.doc-example-live ul li', 'task in tasks').count()).toBe(4);
|
||||
expect(repeater('.doc-example-live ul li', 'task in tasks').column('task')).
|
||||
toEqual(['Learn Angular', 'Read Documentation', 'Check out demos',
|
||||
'Build cool applications']);
|
||||
});
|
||||
|
||||
it('should initialize the task list with for tasks', function() {
|
||||
element('.doc-example ul li a:contains("X"):first').click();
|
||||
expect(repeater('.doc-example ul li', 'task in tasks').count()).toBe(3);
|
||||
element('.doc-example-live ul li a:contains("X"):first').click();
|
||||
expect(repeater('.doc-example-live ul li', 'task in tasks').count()).toBe(3);
|
||||
|
||||
element('.doc-example ul li a:contains("X"):last').click();
|
||||
expect(repeater('.doc-example ul li', 'task in tasks').count()).toBe(2);
|
||||
element('.doc-example-live ul li a:contains("X"):last').click();
|
||||
expect(repeater('.doc-example-live ul li', 'task in tasks').count()).toBe(2);
|
||||
|
||||
expect(repeater('.doc-example ul li', 'task in tasks').column('task')).
|
||||
expect(repeater('.doc-example-live ul li', 'task in tasks').column('task')).
|
||||
toEqual(['Read Documentation', 'Check out demos']);
|
||||
});
|
||||
</doc:scenario>
|
||||
|
|
@ -442,23 +442,23 @@ var angularArray = {
|
|||
});
|
||||
|
||||
it('should create an empty record when "add empty" is clicked', function() {
|
||||
element('.doc-example a:contains("add empty")').click();
|
||||
element('.doc-example-live a:contains("add empty")').click();
|
||||
expect(binding('people')).toBe('people = [{\n "name":"",\n "sex":null}]');
|
||||
});
|
||||
|
||||
it('should create a "John" record when "add \'John\'" is clicked', function() {
|
||||
element('.doc-example a:contains("add \'John\'")').click();
|
||||
element('.doc-example-live a:contains("add \'John\'")').click();
|
||||
expect(binding('people')).toBe('people = [{\n "name":"John",\n "sex":"male"}]');
|
||||
});
|
||||
|
||||
it('should create a "Mary" record when "add \'Mary\'" is clicked', function() {
|
||||
element('.doc-example a:contains("add \'Mary\'")').click();
|
||||
element('.doc-example-live a:contains("add \'Mary\'")').click();
|
||||
expect(binding('people')).toBe('people = [{\n "name":"Mary",\n "sex":"female"}]');
|
||||
});
|
||||
|
||||
it('should delete a record when "X" is clicked', function() {
|
||||
element('.doc-example a:contains("add empty")').click();
|
||||
element('.doc-example li a:contains("X"):first').click();
|
||||
element('.doc-example-live a:contains("add empty")').click();
|
||||
element('.doc-example-live li a:contains("X"):first').click();
|
||||
expect(binding('people')).toBe('people = []');
|
||||
});
|
||||
</doc:scenario>
|
||||
|
|
@ -510,7 +510,7 @@ var angularArray = {
|
|||
});
|
||||
|
||||
it('should recalculate when updated', function() {
|
||||
using('.doc-example li:first-child').input('item.points').enter('23');
|
||||
using('.doc-example-live li:first-child').input('item.points').enter('23');
|
||||
expect(binding('items.$count(\'points==1\')')).toEqual(1);
|
||||
expect(binding('items.$count(\'points>1\')')).toEqual(2);
|
||||
});
|
||||
|
|
@ -586,23 +586,23 @@ var angularArray = {
|
|||
<doc:scenario>
|
||||
it('should be reverse ordered by aged', function() {
|
||||
expect(binding('predicate')).toBe('Sorting predicate = -age');
|
||||
expect(repeater('.doc-example table', 'friend in friends').column('friend.age')).
|
||||
expect(repeater('.doc-example-live table', 'friend in friends').column('friend.age')).
|
||||
toEqual(['35', '29', '21', '19', '10']);
|
||||
expect(repeater('.doc-example table', 'friend in friends').column('friend.name')).
|
||||
expect(repeater('.doc-example-live table', 'friend in friends').column('friend.name')).
|
||||
toEqual(['Adam', 'Julie', 'Mike', 'Mary', 'John']);
|
||||
});
|
||||
|
||||
it('should reorder the table when user selects different predicate', function() {
|
||||
element('.doc-example a:contains("Name")').click();
|
||||
expect(repeater('.doc-example table', 'friend in friends').column('friend.name')).
|
||||
element('.doc-example-live a:contains("Name")').click();
|
||||
expect(repeater('.doc-example-live table', 'friend in friends').column('friend.name')).
|
||||
toEqual(['Adam', 'John', 'Julie', 'Mary', 'Mike']);
|
||||
expect(repeater('.doc-example table', 'friend in friends').column('friend.age')).
|
||||
expect(repeater('.doc-example-live table', 'friend in friends').column('friend.age')).
|
||||
toEqual(['35', '10', '29', '19', '21']);
|
||||
|
||||
element('.doc-example a:contains("Phone")+a:contains("^")').click();
|
||||
expect(repeater('.doc-example table', 'friend in friends').column('friend.phone')).
|
||||
element('.doc-example-live a:contains("Phone")+a:contains("^")').click();
|
||||
expect(repeater('.doc-example-live table', 'friend in friends').column('friend.phone')).
|
||||
toEqual(['555-9876', '555-8765', '555-5678', '555-4321', '555-1212']);
|
||||
expect(repeater('.doc-example table', 'friend in friends').column('friend.name')).
|
||||
expect(repeater('.doc-example-live table', 'friend in friends').column('friend.name')).
|
||||
toEqual(['Mary', 'Julie', 'Adam', 'Mike', 'John']);
|
||||
});
|
||||
</doc:scenario>
|
||||
|
|
@ -684,7 +684,7 @@ var angularArray = {
|
|||
</doc:source>
|
||||
<doc:scenario>
|
||||
it('should limit the numer array to first three items', function() {
|
||||
expect(element('.doc-example input[name=limit]').val()).toBe('3');
|
||||
expect(element('.doc-example-live input[name=limit]').val()).toBe('3');
|
||||
expect(binding('numbers.$limitTo(limit) | json')).toEqual('[1,2,3]');
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -123,7 +123,7 @@ angularFormatter.number = formatter(toString, function(obj){
|
|||
it('should format lists', function(){
|
||||
expect(binding('value')).toEqual('value=["chair","table"]');
|
||||
this.addFutureAction('change to XYZ', function($window, $document, done){
|
||||
$document.elements('.doc-example :input:last').val(',,a,b,').trigger('change');
|
||||
$document.elements('.doc-example-live :input:last').val(',,a,b,').trigger('change');
|
||||
done();
|
||||
});
|
||||
expect(binding('value')).toEqual('value=["a","b"]');
|
||||
|
|
@ -165,7 +165,7 @@ angularFormatter.list = formatter(
|
|||
it('should format trim', function(){
|
||||
expect(binding('value')).toEqual('value="book"');
|
||||
this.addFutureAction('change to XYZ', function($window, $document, done){
|
||||
$document.elements('.doc-example :input:last').val(' text ').trigger('change');
|
||||
$document.elements('.doc-example-live :input:last').val(' text ').trigger('change');
|
||||
done();
|
||||
});
|
||||
expect(binding('value')).toEqual('value="text"');
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ extend(angularValidator, {
|
|||
</doc:source>
|
||||
<doc:scenario>
|
||||
it('should invalidate non ssn', function(){
|
||||
var textBox = element('.doc-example :input');
|
||||
var textBox = element('.doc-example-live :input');
|
||||
expect(textBox.attr('className')).not().toMatch(/ng-validation-error/);
|
||||
expect(textBox.val()).toEqual('123-45-6789');
|
||||
input('ssn').enter('123-45-67890');
|
||||
|
|
@ -68,15 +68,15 @@ extend(angularValidator, {
|
|||
</doc:source>
|
||||
<doc:scenario>
|
||||
it('should invalidate number', function(){
|
||||
var n1 = element('.doc-example :input[name=n1]');
|
||||
var n1 = element('.doc-example-live :input[name=n1]');
|
||||
expect(n1.attr('className')).not().toMatch(/ng-validation-error/);
|
||||
input('n1').enter('1.x');
|
||||
expect(n1.attr('className')).toMatch(/ng-validation-error/);
|
||||
var n2 = element('.doc-example :input[name=n2]');
|
||||
var n2 = element('.doc-example-live :input[name=n2]');
|
||||
expect(n2.attr('className')).not().toMatch(/ng-validation-error/);
|
||||
input('n2').enter('9');
|
||||
expect(n2.attr('className')).toMatch(/ng-validation-error/);
|
||||
var n3 = element('.doc-example :input[name=n3]');
|
||||
var n3 = element('.doc-example-live :input[name=n3]');
|
||||
expect(n3.attr('className')).not().toMatch(/ng-validation-error/);
|
||||
input('n3').enter('201');
|
||||
expect(n3.attr('className')).toMatch(/ng-validation-error/);
|
||||
|
|
@ -122,15 +122,15 @@ extend(angularValidator, {
|
|||
</doc:source>
|
||||
<doc:scenario>
|
||||
it('should invalidate integer', function(){
|
||||
var n1 = element('.doc-example :input[name=n1]');
|
||||
var n1 = element('.doc-example-live :input[name=n1]');
|
||||
expect(n1.attr('className')).not().toMatch(/ng-validation-error/);
|
||||
input('n1').enter('1.1');
|
||||
expect(n1.attr('className')).toMatch(/ng-validation-error/);
|
||||
var n2 = element('.doc-example :input[name=n2]');
|
||||
var n2 = element('.doc-example-live :input[name=n2]');
|
||||
expect(n2.attr('className')).not().toMatch(/ng-validation-error/);
|
||||
input('n2').enter('10.1');
|
||||
expect(n2.attr('className')).toMatch(/ng-validation-error/);
|
||||
var n3 = element('.doc-example :input[name=n3]');
|
||||
var n3 = element('.doc-example-live :input[name=n3]');
|
||||
expect(n3.attr('className')).not().toMatch(/ng-validation-error/);
|
||||
input('n3').enter('100.1');
|
||||
expect(n3.attr('className')).toMatch(/ng-validation-error/);
|
||||
|
|
@ -166,7 +166,7 @@ extend(angularValidator, {
|
|||
</doc:source>
|
||||
<doc:scenario>
|
||||
it('should invalidate date', function(){
|
||||
var n1 = element('.doc-example :input');
|
||||
var n1 = element('.doc-example-live :input');
|
||||
expect(n1.attr('className')).not().toMatch(/ng-validation-error/);
|
||||
input('text').enter('123/123/123');
|
||||
expect(n1.attr('className')).toMatch(/ng-validation-error/);
|
||||
|
|
@ -204,7 +204,7 @@ extend(angularValidator, {
|
|||
</doc:source>
|
||||
<doc:scenario>
|
||||
it('should invalidate email', function(){
|
||||
var n1 = element('.doc-example :input');
|
||||
var n1 = element('.doc-example-live :input');
|
||||
expect(n1.attr('className')).not().toMatch(/ng-validation-error/);
|
||||
input('text').enter('a@b.c');
|
||||
expect(n1.attr('className')).toMatch(/ng-validation-error/);
|
||||
|
|
@ -238,7 +238,7 @@ extend(angularValidator, {
|
|||
</doc:source>
|
||||
<doc:scenario>
|
||||
it('should invalidate phone', function(){
|
||||
var n1 = element('.doc-example :input');
|
||||
var n1 = element('.doc-example-live :input');
|
||||
expect(n1.attr('className')).not().toMatch(/ng-validation-error/);
|
||||
input('text').enter('+12345678');
|
||||
expect(n1.attr('className')).toMatch(/ng-validation-error/);
|
||||
|
|
@ -275,7 +275,7 @@ extend(angularValidator, {
|
|||
</doc:source>
|
||||
<doc:scenario>
|
||||
it('should invalidate url', function(){
|
||||
var n1 = element('.doc-example :input');
|
||||
var n1 = element('.doc-example-live :input');
|
||||
expect(n1.attr('className')).not().toMatch(/ng-validation-error/);
|
||||
input('text').enter('abc://server/path');
|
||||
expect(n1.attr('className')).toMatch(/ng-validation-error/);
|
||||
|
|
@ -310,7 +310,7 @@ extend(angularValidator, {
|
|||
</doc:source>
|
||||
<doc:scenario>
|
||||
it('should invalidate json', function(){
|
||||
var n1 = element('.doc-example :input');
|
||||
var n1 = element('.doc-example-live :input');
|
||||
expect(n1.attr('className')).not().toMatch(/ng-validation-error/);
|
||||
input('json').enter('{name}');
|
||||
expect(n1.attr('className')).toMatch(/ng-validation-error/);
|
||||
|
|
@ -382,7 +382,7 @@ extend(angularValidator, {
|
|||
</doc:source>
|
||||
<doc:scenario>
|
||||
it('should change color in delayed way', function(){
|
||||
var textBox = element('.doc-example :input');
|
||||
var textBox = element('.doc-example-live :input');
|
||||
expect(textBox.attr('className')).not().toMatch(/ng-input-indicator-wait/);
|
||||
expect(textBox.attr('className')).not().toMatch(/ng-validation-error/);
|
||||
input('text').enter('X');
|
||||
|
|
|
|||
|
|
@ -625,15 +625,15 @@ angularWidget('option', function(){
|
|||
</doc:source>
|
||||
<doc:scenario>
|
||||
it('should load date filter', function(){
|
||||
expect(element('.doc-example ng\\:include').text()).toMatch(/angular\.filter\.date/);
|
||||
expect(element('.doc-example-live ng\\:include').text()).toMatch(/angular\.filter\.date/);
|
||||
});
|
||||
it('should change to hmtl filter', function(){
|
||||
select('url').option('angular.filter.html.html');
|
||||
expect(element('.doc-example ng\\:include').text()).toMatch(/angular\.filter\.html/);
|
||||
expect(element('.doc-example-live ng\\:include').text()).toMatch(/angular\.filter\.html/);
|
||||
});
|
||||
it('should change to blank', function(){
|
||||
select('url').option('(blank)');
|
||||
expect(element('.doc-example ng\\:include').text()).toEqual('');
|
||||
select('url').option('');
|
||||
expect(element('.doc-example-live ng\\:include').text()).toEqual('');
|
||||
});
|
||||
</doc:scenario>
|
||||
</doc:example>
|
||||
|
|
@ -729,15 +729,15 @@ angularWidget('ng:include', function(element){
|
|||
</doc:source>
|
||||
<doc:scenario>
|
||||
it('should start in settings', function(){
|
||||
expect(element('.doc-example ng\\:switch').text()).toEqual('Settings Div');
|
||||
expect(element('.doc-example-live ng\\:switch').text()).toEqual('Settings Div');
|
||||
});
|
||||
it('should change to home', function(){
|
||||
select('switch').option('home');
|
||||
expect(element('.doc-example ng\\:switch').text()).toEqual('Home Span');
|
||||
expect(element('.doc-example-live ng\\:switch').text()).toEqual('Home Span');
|
||||
});
|
||||
it('should select deafault', function(){
|
||||
select('switch').option('other');
|
||||
expect(element('.doc-example ng\\:switch').text()).toEqual('default');
|
||||
expect(element('.doc-example-live ng\\:switch').text()).toEqual('default');
|
||||
});
|
||||
</doc:scenario>
|
||||
</doc:example>
|
||||
|
|
|
|||
Loading…
Reference in a new issue