diff options
| author | Andres Ornelas | 2010-05-24 17:48:17 -0700 |
|---|---|---|
| committer | Andres Ornelas | 2010-05-24 17:48:17 -0700 |
| commit | 55c0767f16e60e77e9d1b4d46698ddbf343ed8b1 (patch) | |
| tree | 8dd944b5e5d95d775a0c0a22af0b30c3a4115006 /test | |
| parent | 3fab5d9879272b9f991a67c8135754f00c055834 (diff) | |
| download | angular.js-55c0767f16e60e77e9d1b4d46698ddbf343ed8b1.tar.bz2 | |
added dsl tests and select method
Diffstat (limited to 'test')
| -rw-r--r-- | test/scenario/DSLSpec.js | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/test/scenario/DSLSpec.js b/test/scenario/DSLSpec.js new file mode 100644 index 00000000..3c16876d --- /dev/null +++ b/test/scenario/DSLSpec.js @@ -0,0 +1,40 @@ +describe("DSL", function() { + + var lastStep, executeStep, lastDocument; + + beforeEach(function() { + lastStep = null; + $scenario = { + addStep: function(name, stepFunction) { + lastStep = { name:name, fn: stepFunction}; + } + }; + executeStep = function(step, html, callback) { + lastDocument =_jQuery('<div>' + html + '</div>'); + var specThis = { + testWindow: window, + testDocument: lastDocument + }; + step.fn.call(specThis, callback || noop); + }; + }); + + describe("input", function() { + + var input = angular.scenario.dsl.input; + it('should enter', function() { + input('name').enter('John'); + expect(lastStep.name).toEqual("Set input text of 'name' to 'John'"); + executeStep(lastStep, '<input type="text" name="name" />'); + expect(lastDocument.find('input').val()).toEqual('John'); + }); + + it('should select', function() { + input('gender').select('female'); + expect(lastStep.name).toEqual("Select radio 'gender' to 'female'"); + executeStep(lastStep, '<input type="radio" name="0@gender" value="male"/>' + + '<input type="radio" name="0@gender" value="female"/>'); + expect(lastDocument.find(':radio:checked').val()).toEqual('female'); + }); + }); +});
\ No newline at end of file |
