aboutsummaryrefslogtreecommitdiffstats
path: root/test/ngScenario/dslSpec.js
diff options
context:
space:
mode:
authorAdam Macejak2012-10-29 21:54:26 -0400
committerIgor Minar2012-10-31 13:58:13 -0700
commit249a1d84e7ac3b8528d317b8b0a80acb5dd9a271 (patch)
tree0d57fd0c5d7ffa31ae4067157838036dc505fcbd /test/ngScenario/dslSpec.js
parentfdf85bfd86175fb513c214141b82f30fbaa9be4f (diff)
downloadangular.js-249a1d84e7ac3b8528d317b8b0a80acb5dd9a271.tar.bz2
fix(scenario-runner): support data-ng and x-ng based attributes
Prefixed attributes like data-ng-model and x-ng-model were not being found by the Selector. It was only looking at ng: and ng- prefixed attributes. Added a few tests as well to ensure the aforementioned prefixed attributes are being matched properly. Closes #1020
Diffstat (limited to 'test/ngScenario/dslSpec.js')
-rw-r--r--test/ngScenario/dslSpec.js38
1 files changed, 38 insertions, 0 deletions
diff --git a/test/ngScenario/dslSpec.js b/test/ngScenario/dslSpec.js
index 9c7893fd..4a4b17bc 100644
--- a/test/ngScenario/dslSpec.js
+++ b/test/ngScenario/dslSpec.js
@@ -217,6 +217,30 @@ describe("angular.scenario.dsl", function() {
expect(doc.find('[ng-model="test"]').val()).toEqual('A');
});
+ it('should select single option using data-ng', function() {
+ doc.append(
+ '<select data-ng-model="test">' +
+ ' <option value=A>one</option>' +
+ ' <option value=B selected>two</option>' +
+ '</select>'
+ );
+ $root.dsl.select('test').option('A');
+ expect(doc.find('[data-ng-model="test"]').val()).toEqual('A');
+ });
+ it('should select single option using x-ng', function() {
+ doc.append(
+ '<select x-ng-model="test">' +
+ ' <option value=A>one</option>' +
+ ' <option value=B selected>two</option>' +
+ '</select>'
+ );
+ $root.dsl.select('test').option('A');
+ expect(doc.find('[x-ng-model="test"]').val()).toEqual('A');
+ });
+
+
+
+
it('should select option by name', function() {
doc.append(
'<select ng-model="test">' +
@@ -574,6 +598,20 @@ describe("angular.scenario.dsl", function() {
chain.enter('foo');
expect(_jQuery('input[ng-model="test.input"]').val()).toEqual('foo');
});
+ it('should change value in text input in data-ng form', function() {
+ doc.append('<input data-ng-model="test.input" value="something">');
+ var chain = $root.dsl.input('test.input');
+ chain.enter('foo');
+ expect(_jQuery('input[data-ng-model="test.input"]').val()).toEqual('foo');
+ });
+ it('should change value in text input in x-ng form', function() {
+ doc.append('<input x-ng-model="test.input" value="something">');
+ var chain = $root.dsl.input('test.input');
+ chain.enter('foo');
+ expect(_jQuery('input[x-ng-model="test.input"]').val()).toEqual('foo');
+ });
+
+
it('should return error if no input exists', function() {
var chain = $root.dsl.input('test.input');