Should have replaced all instances of element('input[name=something]').val() with input('name').val()

Closes #376
This commit is contained in:
Di Peng 2011-06-08 11:18:41 -07:00 committed by Misko Hevery
parent 91a34a7027
commit e4a00626d8
2 changed files with 8 additions and 8 deletions

View file

@ -170,32 +170,32 @@ angularTextMarkup('option', function(text, textNode, parentElement){
<doc:scenario>
it('should execute ng:click but not reload when href without value', function() {
element('#link-1').click();
expect(element('input[name=value]').val()).toEqual('1');
expect(input('value').val()).toEqual('1');
expect(element('#link-1').attr('href')).toBe("");
});
it('should execute ng:click but not reload when href empty string', function() {
element('#link-2').click();
expect(element('input[name=value]').val()).toEqual('2');
expect(input('value').val()).toEqual('2');
expect(element('#link-2').attr('href')).toBe("");
});
it('should execute ng:click and change url when ng:href specified', function() {
element('#link-3').click();
expect(element('input[name=value]').val()).toEqual('3');
expect(input('value').val()).toEqual('3');
expect(element('#link-3').attr('href')).toBe("#123");
expect(browser().location().hash()).toEqual('123');
});
it('should execute ng:click but not reload when href empty string and name specified', function() {
element('#link-4').click();
expect(element('input[name=value]').val()).toEqual('4');
expect(input('value').val()).toEqual('4');
expect(element('#link-4').attr('href')).toBe("");
});
it('should execute ng:click but not reload when no href but name specified', function() {
element('#link-5').click();
expect(element('input[name=value]').val()).toEqual('5');
expect(input('value').val()).toEqual('5');
expect(element('#link-5').attr('href')).toBe(undefined);
});

View file

@ -39,7 +39,7 @@ var URL_MATCH = /^(file|ftp|http|https):\/\/(\w+:{0,1}\w*@)?([\w\.-]*)(:([0-9]+)
</doc:source>
<doc:scenario>
it('should initialize the input field', function() {
expect(using('.doc-example-live').element('input[name=$location.hash]').val()).
expect(using('.doc-example-live').input('$location.hash').val()).
toBe('!/api/angular.service.$location');
});
@ -52,14 +52,14 @@ var URL_MATCH = /^(file|ftp|http|https):\/\/(\w+:{0,1}\w*@)?([\w\.-]*)(:([0-9]+)
it('should set the hash to a test string with test link is presed', function() {
using('.doc-example-live').element('#ex-test').click();
expect(using('.doc-example-live').element('input[name=$location.hash]').val()).
expect(using('.doc-example-live').input('$location.hash').val()).
toBe('myPath?name=misko');
});
it('should reset $location when reset link is pressed', function() {
using('.doc-example-live').input('$location.hash').enter('foo');
using('.doc-example-live').element('#ex-reset').click();
expect(using('.doc-example-live').element('input[name=$location.hash]').val()).
expect(using('.doc-example-live').input('$location.hash').val()).
toBe('!/api/angular.service.$location');
});