Skip to content
This repository was archived by the owner on Dec 12, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 11 additions & 5 deletions bin/configure.js
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ function variables(ninja) {
ninja.assign('jscompiler_jar',
'bower_components/closure-compiler/compiler.jar');
ninja.assign('jasmine_js',
'third-party/phantomjs/examples/run-jasmine.js');
'third-party/phantomjs/examples/run-jasmine2.js');
ninja.assign('gjslint_py',
'node_modules/closure-linter-wrapper/tools/gjslint.py')
ninja.assign('fixjsstyle_py',
Expand Down Expand Up @@ -375,17 +375,22 @@ function targets(ninja) {

ninja.edge('$builddir/test/jasmine.css')
.using('symlink')
.from('bower_components/jasmine/lib/jasmine-1.3.1/jasmine.css')
.from('bower_components/jasmine-core/lib/jasmine-core/jasmine.css')
.assign('prefix', '../../');

ninja.edge('$builddir/test/jasmine.js')
.using('symlink')
.from('bower_components/jasmine/lib/jasmine-1.3.1/jasmine.js')
.from('bower_components/jasmine-core/lib/jasmine-core/jasmine.js')
.assign('prefix', '../../');

ninja.edge('$builddir/test/jasmine-html.js')
.using('symlink')
.from('bower_components/jasmine/lib/jasmine-1.3.1/jasmine-html.js')
.from('bower_components/jasmine-core/lib/jasmine-core/jasmine-html.js')
.assign('prefix', '../../');

ninja.edge('$builddir/test/jasmine-boot.js')
.using('symlink')
.from('bower_components/jasmine-core/lib/jasmine-core/boot.js')
.assign('prefix', '../../');

ninja.edge('$builddir/test/runner.html')
Expand All @@ -395,7 +400,8 @@ function targets(ninja) {
'$builddir/test/manifest.js',
'$builddir/test/jasmine.css',
'$builddir/test/jasmine.js',
'$builddir/test/jasmine-html.js'
'$builddir/test/jasmine-html.js',
'$builddir/test/jasmine-boot.js'
]))
.assign('prefix', '../../');

Expand Down
8 changes: 4 additions & 4 deletions bower.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@
],
"devDependencies": {
"closure-compiler": "http://dl.google.com/closure-compiler/compiler-20141215.zip",
"jasmine": "https://github.com/pivotal/jasmine/raw/ea76a30d85218954625d4685b246218d9ca2dfe1/dist/jasmine-standalone-1.3.1.zip",
"webpy": "https://github.com/webpy/webpy/archive/73f1119649ffe54ba26ddaf6a612aaf1dab79b7f.zip",
"web-starter-kit": "~0.4.0",
"jasmine-core": "jasmine#~2.3.4",
"octicons": "~2.1.2",
"spf": "2.1.1"
"spf": "2.1.1",
"web-starter-kit": "~0.4.0",
"webpy": "https://github.com/webpy/webpy/archive/73f1119649ffe54ba26ddaf6a612aaf1dab79b7f.zip"
}
}
4 changes: 2 additions & 2 deletions src/client/base_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,8 @@ describe('spf', function() {
pass: function() { return 'pass'; },
fail: function() { throw err; }
};
spyOn(foo, 'pass').andCallThrough();
spyOn(foo, 'fail').andCallThrough();
spyOn(foo, 'pass').and.callThrough();
spyOn(foo, 'fail').and.callThrough();
expect(spf.execute(foo.pass)).toEqual('pass');
expect(foo.pass).toHaveBeenCalled();
expect(spf.execute(foo.fail)).toEqual(err);
Expand Down
52 changes: 26 additions & 26 deletions src/client/history/history_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,9 @@ describe('spf.history', function() {
stack.pop();
stack.push({ state: data, title: title, url: opt_url });
};
spyOn(spf.history, 'doPushState_').andCallThrough();
spyOn(spf.history, 'doReplaceState_').andCallThrough();
spyOn(window.history, 'back').andCallFake(function() {
spyOn(spf.history, 'doPushState_').and.callThrough();
spyOn(spf.history, 'doReplaceState_').and.callThrough();
spyOn(window.history, 'back').and.callFake(function() {
var evt = stack.pop();
spf.history.pop_(evt);
});
Expand Down Expand Up @@ -84,14 +84,14 @@ describe('spf.history', function() {
// Start with the initial entry.
expect(stack.length).toBe(1);
expect(getEntry(1).state['spf-timestamp']).toBeGreaterThan(0);
expect(spf.history.doPushState_.calls.length).toEqual(0);
expect(spf.history.doReplaceState_.calls.length).toEqual(1);
expect(spf.history.doPushState_.calls.count()).toEqual(0);
expect(spf.history.doReplaceState_.calls.count()).toEqual(1);
// Add an entry without executing the callback.
time.advance = 100;
spf.history.add('/foo');
expect(stack.length).toBe(2);
expect(spf.history.doPushState_.calls.length).toEqual(1);
expect(spf.history.doReplaceState_.calls.length).toEqual(1);
expect(spf.history.doPushState_.calls.count()).toEqual(1);
expect(spf.history.doReplaceState_.calls.count()).toEqual(1);
expect(callbacks.one).not.toHaveBeenCalled();
expect(getEntry(1).state['spf-timestamp']).toBeGreaterThan(
getEntry(2).state['spf-timestamp']);
Expand All @@ -100,8 +100,8 @@ describe('spf.history', function() {
time.advance = 200;
spf.history.add('/bar', null, true);
expect(stack.length).toBe(3);
expect(spf.history.doPushState_.calls.length).toEqual(2);
expect(spf.history.doReplaceState_.calls.length).toEqual(1);
expect(spf.history.doPushState_.calls.count()).toEqual(2);
expect(spf.history.doReplaceState_.calls.count()).toEqual(1);
expect(callbacks.one).toHaveBeenCalled();
expect(getEntry(1).state['spf-timestamp']).toBeGreaterThan(
getEntry(2).state['spf-timestamp']);
Expand All @@ -117,23 +117,23 @@ describe('spf.history', function() {
// Start with the initial entry.
expect(stack.length).toBe(1);
expect(getEntry(1).state['spf-timestamp']).toBeGreaterThan(0);
expect(spf.history.doPushState_.calls.length).toEqual(0);
expect(spf.history.doReplaceState_.calls.length).toEqual(1);
expect(spf.history.doPushState_.calls.count()).toEqual(0);
expect(spf.history.doReplaceState_.calls.count()).toEqual(1);
// Replace the top entry without executing the callback.
time.advance = 100;
spf.history.replace('/foo');
expect(stack.length).toBe(1);
expect(spf.history.doPushState_.calls.length).toEqual(0);
expect(spf.history.doReplaceState_.calls.length).toEqual(2);
expect(spf.history.doPushState_.calls.count()).toEqual(0);
expect(spf.history.doReplaceState_.calls.count()).toEqual(2);
expect(callbacks.one).not.toHaveBeenCalled();
expect(getEntry(1).state['spf-timestamp']).toBeGreaterThan(0);
expect(getEntry(1).url).toEqual('/foo');
// Replace the top entry and execute the callback.
time.advance = 200;
spf.history.replace('/foo', null, true);
expect(stack.length).toBe(1);
expect(spf.history.doPushState_.calls.length).toEqual(0);
expect(spf.history.doReplaceState_.calls.length).toEqual(3);
expect(spf.history.doPushState_.calls.count()).toEqual(0);
expect(spf.history.doReplaceState_.calls.count()).toEqual(3);
expect(callbacks.one).toHaveBeenCalled();
expect(getEntry(1).state['spf-timestamp']).toBeGreaterThan(0);
expect(getEntry(1).url).toEqual('/foo');
Expand All @@ -143,8 +143,8 @@ describe('spf.history', function() {
time.advance = 400;
spf.history.replace('/bar');
expect(stack.length).toBe(1);
expect(spf.history.doPushState_.calls.length).toEqual(0);
expect(spf.history.doReplaceState_.calls.length).toEqual(5);
expect(spf.history.doPushState_.calls.count()).toEqual(0);
expect(spf.history.doReplaceState_.calls.count()).toEqual(5);
expect(getEntry(1).state['test']).toEqual('state');
expect(getEntry(1).state['spf-timestamp']).toBeGreaterThan(0);
expect(getEntry(1).url).toEqual('/bar');
Expand All @@ -159,8 +159,8 @@ describe('spf.history', function() {
// Start with the initial entry.
expect(stack.length).toBe(1);
expect(getEntry(1).state['spf-timestamp']).toBeGreaterThan(0);
expect(spf.history.doPushState_.calls.length).toEqual(0);
expect(spf.history.doReplaceState_.calls.length).toEqual(1);
expect(spf.history.doPushState_.calls.count()).toEqual(0);
expect(spf.history.doReplaceState_.calls.count()).toEqual(1);
// Add entries without executing the callback.
time.advance = 100;
spf.history.add('/foo');
Expand All @@ -169,18 +169,18 @@ describe('spf.history', function() {
// Simulate a back button pop event.
time.advance = 300;
window.history.back();
expect(callbacks.one.calls.length).toEqual(1);
expect(callbacks.one.calls.count()).toEqual(1);
// Re-add Entry.
time.advance = 200;
spf.history.add('/bar');
// Call removeCurrentEntry instead.
time.advance = 300;
spf.history.removeCurrentEntry();
expect(callbacks.one.calls.length).toEqual(1);
expect(callbacks.one.calls.count()).toEqual(1);
// Test subsequent back.
time.advance = 300;
window.history.back();
expect(callbacks.one.calls.length).toEqual(2);
expect(callbacks.one.calls.count()).toEqual(2);
});

it('pop_', function() {
Expand All @@ -192,8 +192,8 @@ describe('spf.history', function() {
// Start with the initial entry.
expect(stack.length).toBe(1);
expect(getEntry(1).state['spf-timestamp']).toBeGreaterThan(0);
expect(spf.history.doPushState_.calls.length).toEqual(0);
expect(spf.history.doReplaceState_.calls.length).toEqual(1);
expect(spf.history.doPushState_.calls.count()).toEqual(0);
expect(spf.history.doReplaceState_.calls.count()).toEqual(1);
// Add entries without executing the callback.
time.advance = 100;
spf.history.add('/foo');
Expand All @@ -205,14 +205,14 @@ describe('spf.history', function() {
var evt = { state: getEntry(1).state };
spf.history.pop_(evt);
expect(evt.state['spf-back']).toBe(true);
expect(callbacks.one.calls.length).toEqual(1);
expect(callbacks.one.calls.count()).toEqual(1);
// Simulate a forward button pop event.
time.advance = 400;
stack.push(prev);
var evt = { state: getEntry(1).state };
spf.history.pop_(evt);
expect(evt.state['spf-back']).toBe(false);
expect(callbacks.one.calls.length).toEqual(2);
expect(callbacks.one.calls.count()).toEqual(2);
});

});
Loading