Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update signals.spec.js #165

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 12 additions & 12 deletions dev/tests/spec/signals.spec.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*jshint onevar:false */

//for node
var crossroads = crossroads || require('../../../dist/crossroads');
let crossroads = crossroads || require('../../../dist/crossroads');
//end node


Expand All @@ -18,8 +18,8 @@ describe('crossroads Signals', function(){


it('should dispatch bypassed if don\'t match any route', function(){
var count = 0, requests = [];
var a = crossroads.addRoute('/{foo}_{bar}');
let count = 0, requests = [];
let a = crossroads.addRoute('/{foo}_{bar}');

a.matched.add(function(foo, bar){
expect(null).toEqual('fail: shouldn\'t match');
Expand All @@ -39,13 +39,13 @@ describe('crossroads Signals', function(){


it('should dispatch routed at each match', function(){
var count = 0,
let count = 0,
requests = [],
count2 = 0,
routed,
first;

var a = crossroads.addRoute('/{foo}_{bar}');
let a = crossroads.addRoute('/{foo}_{bar}');
a.matched.add(function(foo, bar){
count++;
});
Expand Down Expand Up @@ -80,12 +80,12 @@ describe('crossroads Signals', function(){
});

it('should not dispatch routed/bypassed/matched twice for same request multiple times in a row', function(){
var bypassed = [],
let bypassed = [],
routed = [],
matched = [],
switched = [];

var a = crossroads.addRoute('/{foo}_{bar}');
let a = crossroads.addRoute('/{foo}_{bar}');
a.matched.add(function(a, b){
matched.push(a, b);
});
Expand Down Expand Up @@ -132,20 +132,20 @@ describe('crossroads Signals', function(){
});

it('should dispatch routed/bypassed/matched twice for same request if calling resetState() in between', function(){
var bypassed = [],
let bypassed = [],
routed = [],
matched = [],
switched = [];

var a = crossroads.addRoute('/{foo}_{bar}');
let a = crossroads.addRoute('/{foo}_{bar}');
a.matched.add(function(a, b){
matched.push(a, b);
});
a.switched.add(function(req){
switched.push(req);
});

var b = crossroads.addRoute('/maecennas');
let b = crossroads.addRoute('/maecennas');
b.matched.add(function(){
matched.push('maecennas');
});
Expand Down Expand Up @@ -216,15 +216,15 @@ describe('crossroads Signals', function(){


it('should dispatch routed/bypassed/matched multiple times for same request if ignoreState == true', function(){
var bypassed = [],
let bypassed = [],
routed = [],
matched = [],
switched = [];

// toggle behavior
crossroads.ignoreState = true;

var a = crossroads.addRoute('/{foo}_{bar}');
let a = crossroads.addRoute('/{foo}_{bar}');
a.matched.add(function(a, b){
matched.push(a, b);
});
Expand Down