aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDi Peng2011-06-08 11:18:41 -0700
committerMisko Hevery2011-06-08 15:54:57 -0700
commite4a00626d85de82cf7825111bbce89784ea4cbc8 (patch)
treed0aef2c878abbef49872d8a806c6eded31140d50
parent91a34a7027caf0a3f0f4bdaf6649fb6cf479bba8 (diff)
downloadangular.js-e4a00626d85de82cf7825111bbce89784ea4cbc8.tar.bz2
Should have replaced all instances of element('input[name=something]').val() with input('name').val()
Closes #376
-rw-r--r--src/markups.js10
-rw-r--r--src/service/location.js6
2 files changed, 8 insertions, 8 deletions
diff --git a/src/markups.js b/src/markups.js
index 1f2ec8a6..5e240a92 100644
--- a/src/markups.js
+++ b/src/markups.js
@@ -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);
});
diff --git a/src/service/location.js b/src/service/location.js
index 0cfa2e83..f03dc009 100644
--- a/src/service/location.js
+++ b/src/service/location.js
@@ -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');
});