Skip to content

Commit 6ddcf91

Browse files
committed
Fix test which was causing the Chrome runner to fail. Upgraded JSTD to latest. Cleanup whitespace.
1 parent 8a867ce commit 6ddcf91

9 files changed

Lines changed: 52 additions & 50 deletions

File tree

lib/jstestdriver/JsTestDriver.jar

517 KB
Binary file not shown.

test/scenario/ApplicationSpec.js

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ describe('angular.scenario.Application', function() {
99
it('should return new $window and $document after navigate', function() {
1010
var testWindow, testDocument, counter = 0;
1111
app.navigateTo = noop;
12-
app.getWindow = function() {
13-
return {x:counter++, document:{x:counter++}};
12+
app.getWindow = function() {
13+
return {x:counter++, document:{x:counter++}};
1414
};
1515
app.navigateTo('http://www.google.com/');
1616
app.executeAction(function($document, $window) {
@@ -26,44 +26,44 @@ describe('angular.scenario.Application', function() {
2626

2727
it('should execute callback with correct arguments', function() {
2828
var testWindow = {document: {}};
29-
app.getWindow = function() {
30-
return testWindow;
29+
app.getWindow = function() {
30+
return testWindow;
3131
};
3232
app.executeAction(function($window, $document) {
3333
expect(this).toEqual(app);
3434
expect($document).toEqual(_jQuery($window.document));
3535
expect($window).toEqual(testWindow);
3636
});
3737
});
38-
38+
3939
it('should create a new iframe each time', function() {
4040
app.navigateTo('about:blank');
4141
var frame = app.getFrame();
4242
frame.attr('test', true);
4343
app.navigateTo('about:blank');
4444
expect(app.getFrame().attr('test')).toBeFalsy();
4545
});
46-
46+
4747
it('should URL description bar', function() {
4848
app.navigateTo('about:blank');
4949
var anchor = frames.find('> h2 a');
5050
expect(anchor.attr('href')).toEqual('about:blank');
5151
expect(anchor.text()).toEqual('about:blank');
5252
});
53-
53+
5454
it('should call onload handler when frame loads', function() {
5555
var called;
5656
app.getFrame = function() {
5757
// Mock a little jQuery
5858
var result = {
59-
remove: function() {
60-
return result;
59+
remove: function() {
60+
return result;
6161
},
62-
attr: function(key, value) {
62+
attr: function(key, value) {
6363
return (!value) ? 'attribute value' : result;
6464
},
65-
load: function() {
66-
called = true;
65+
load: function() {
66+
called = true;
6767
}
6868
};
6969
return result;

test/scenario/DescribeSpec.js

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,21 +4,21 @@ describe('angular.scenario.Describe', function() {
44

55
beforeEach(function() {
66
root = new angular.scenario.Describe();
7-
7+
88
/**
99
* Simple callback logging system. Use to assert proper order of calls.
1010
*/
11-
log = function(text) {
12-
log.text = log.text + text;
11+
log = function(text) {
12+
log.text = log.text + text;
1313
};
1414
log.fn = function(text) {
15-
return function(done){
16-
log(text);
17-
(done || angular.noop)();
15+
return function(done){
16+
log(text);
17+
(done || angular.noop)();
1818
};
1919
};
20-
log.reset = function() {
21-
log.text = '';
20+
log.reset = function() {
21+
log.text = '';
2222
};
2323
log.reset();
2424
});
@@ -50,7 +50,7 @@ describe('angular.scenario.Describe', function() {
5050
specs[1].after();
5151
expect(log.text).toEqual('{1}');
5252
});
53-
53+
5454
it('should link nested describe blocks with parent and children', function() {
5555
root.describe('A', function() {
5656
this.it('1', angular.noop);
@@ -65,7 +65,7 @@ describe('angular.scenario.Describe', function() {
6565
expect(specs[2].definition.parent).toEqual(root);
6666
expect(specs[0].definition.parent).toEqual(specs[2].definition.children[0]);
6767
});
68-
68+
6969
it('should not process xit and xdescribe', function() {
7070
root.describe('A', function() {
7171
this.xit('1', angular.noop);
@@ -79,7 +79,7 @@ describe('angular.scenario.Describe', function() {
7979
var specs = root.getSpecs();
8080
expect(specs.length).toEqual(0);
8181
});
82-
82+
8383
it('should create uniqueIds in the tree', function() {
8484
angular.scenario.Describe.id = 0;
8585
var a = new angular.scenario.Describe();

test/scenario/FutureSpec.js

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
describe('angular.scenario.Future', function() {
22
var future;
3-
3+
44
it('should set the sane defaults', function() {
55
var behavior = function() {};
66
var future = new angular.scenario.Future('test name', behavior, 'foo');
@@ -11,15 +11,15 @@ describe('angular.scenario.Future', function() {
1111
expect(future.fulfilled).toBeFalsy();
1212
expect(future.parser).toEqual(angular.identity);
1313
});
14-
14+
1515
it('should be fulfilled after execution and done callback', function() {
1616
var future = new angular.scenario.Future('test name', function(done) {
1717
done();
1818
});
1919
future.execute(angular.noop);
2020
expect(future.fulfilled).toBeTruthy();
2121
});
22-
22+
2323
it('should take callback with (error, result) and forward', function() {
2424
var future = new angular.scenario.Future('test name', function(done) {
2525
done(10, 20);
@@ -29,31 +29,31 @@ describe('angular.scenario.Future', function() {
2929
expect(result).toEqual(20);
3030
});
3131
});
32-
32+
3333
it('should use error as value if provided', function() {
3434
var future = new angular.scenario.Future('test name', function(done) {
3535
done(10, 20);
3636
});
3737
future.execute(angular.noop);
3838
expect(future.value).toEqual(10);
3939
});
40-
40+
4141
it('should parse json with fromJson', function() {
4242
var future = new angular.scenario.Future('test name', function(done) {
4343
done(null, "{test: 'foo'}");
4444
});
4545
future.fromJson().execute(angular.noop);
4646
expect(future.value).toEqual({test: 'foo'});
4747
});
48-
48+
4949
it('should convert to json with toJson', function() {
5050
var future = new angular.scenario.Future('test name', function(done) {
5151
done(null, {test: 'foo'});
5252
});
5353
future.toJson().execute(angular.noop);
5454
expect(future.value).toEqual('{"test":"foo"}');
5555
});
56-
56+
5757
it('should convert with custom parser', function() {
5858
var future = new angular.scenario.Future('test name', function(done) {
5959
done(null, 'foo');
@@ -63,13 +63,13 @@ describe('angular.scenario.Future', function() {
6363
}).execute(angular.noop);
6464
expect(future.value).toEqual('FOO');
6565
});
66-
66+
6767
it('should pass error if parser fails', function() {
6868
var future = new angular.scenario.Future('test name', function(done) {
6969
done(null, '{');
7070
});
7171
future.fromJson().execute(function(error, result) {
7272
expect(error).toBeDefined();
7373
});
74-
});
74+
});
7575
});

test/scenario/HtmlUISpec.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ describe('angular.scenario.HtmlUI', function() {
22
var ui;
33
var context;
44
var spec;
5-
5+
66
function line() { return 'unknown:-1'; }
77

88
beforeEach(function() {
@@ -85,7 +85,7 @@ describe('angular.scenario.HtmlUI', function() {
8585
expect(timer.innerHTML).toMatch(/ms$/);
8686
});
8787
});
88-
88+
8989
it('should include line if provided', function() {
9090
specUI = ui.addSpec(spec);
9191
specUI.addStep('some step', line).finish('error!');

test/scenario/RunnerSpec.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ MockSpecRunner.prototype.addFuture = function(name, fn, line) {
1616
describe('angular.scenario.Runner', function() {
1717
var $window;
1818
var runner;
19-
19+
2020
beforeEach(function() {
2121
// Trick to get the scope out of a DSL statement
2222
angular.scenario.dsl('dslAddFuture', function() {
@@ -42,12 +42,12 @@ describe('angular.scenario.Runner', function() {
4242
};
4343
runner = new angular.scenario.Runner($window);
4444
});
45-
45+
4646
afterEach(function() {
4747
delete angular.scenario.dsl.dslScope;
4848
delete angular.scenario.dsl.dslChain;
4949
});
50-
50+
5151
it('should publish the functions in the public API', function() {
5252
angular.foreach(runner.api, function(fn, name) {
5353
var func;
@@ -57,7 +57,7 @@ describe('angular.scenario.Runner', function() {
5757
expect(angular.isFunction(func)).toBeTruthy();
5858
});
5959
});
60-
60+
6161
it('should construct valid describe trees with public API', function() {
6262
var before = [];
6363
var after = [];
@@ -85,7 +85,7 @@ describe('angular.scenario.Runner', function() {
8585
expect(specs[2].definition.parent).toEqual(runner.rootDescribe);
8686
expect(specs[0].definition.parent).toEqual(specs[2].definition.children[0]);
8787
});
88-
88+
8989
it('should publish the DSL statements to the $window', function() {
9090
$window.describe('describe', function() {
9191
$window.it('1', function() {
@@ -94,7 +94,7 @@ describe('angular.scenario.Runner', function() {
9494
});
9595
runner.run(null/*ui*/, null/*application*/, MockSpecRunner, rethrow);
9696
});
97-
97+
9898
it('should create a new scope for each DSL chain', function() {
9999
$window.describe('describe', function() {
100100
$window.it('1', function() {

test/scenario/SpecRunnerSpec.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ ApplicationMock.prototype = {
4949
describe('angular.scenario.SpecRunner', function() {
5050
var $window;
5151
var runner;
52-
52+
5353
function createSpec(name, body) {
5454
return {
5555
name: name,
@@ -93,8 +93,8 @@ describe('angular.scenario.SpecRunner', function() {
9393
it('should execute spec function and notify UI', function() {
9494
var finished;
9595
var ui = new UIMock();
96-
var spec = createSpec('test spec', function() {
97-
this.test = 'some value';
96+
var spec = createSpec('test spec', function() {
97+
this.test = 'some value';
9898
});
9999
runner.addFuture('test future', function(done) {
100100
done();
@@ -115,7 +115,7 @@ describe('angular.scenario.SpecRunner', function() {
115115
it('should execute notify UI on spec setup error', function() {
116116
var finished;
117117
var ui = new UIMock();
118-
var spec = createSpec('test spec', function() {
118+
var spec = createSpec('test spec', function() {
119119
throw 'message';
120120
});
121121
runner.run(ui, spec, function() {
@@ -166,7 +166,7 @@ describe('angular.scenario.SpecRunner', function() {
166166
'spec finish:'
167167
]);
168168
});
169-
169+
170170
it('should run after handlers even if error in body of spec', function() {
171171
var finished, after;
172172
var ui = new UIMock();

test/scenario/dslSpec.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,9 @@ describe("angular.scenario.dsl", function() {
190190
describe('Element', function() {
191191
it('should execute click', function() {
192192
var clicked;
193-
doc.append('<a href=""></a>');
193+
// Hash is important, otherwise we actually
194+
// go to a different page and break the runner
195+
doc.append('<a href="#"></a>');
194196
doc.find('a').click(function() {
195197
clicked = true;
196198
});

test/scenario/matchersSpec.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
describe('angular.scenario.matchers', function () {
22
var matchers;
3-
3+
44
function expectMatcher(value, test) {
55
delete matchers.error;
66
delete matchers.future.value;
@@ -10,9 +10,9 @@ describe('angular.scenario.matchers', function () {
1010
test();
1111
expect(matchers.error).toBeUndefined();
1212
}
13-
13+
1414
beforeEach(function() {
15-
/**
15+
/**
1616
* Mock up the future system wrapped around matchers.
1717
*
1818
* @see Scenario.js#angular.scenario.matcher
@@ -27,7 +27,7 @@ describe('angular.scenario.matchers', function () {
2727
};
2828
angular.extend(matchers, angular.scenario.matcher);
2929
});
30-
30+
3131
it('should handle basic matching', function() {
3232
expectMatcher(10, function() { matchers.toEqual(10); });
3333
expectMatcher('value', function() { matchers.toBeDefined(); });

0 commit comments

Comments
 (0)