var ArrayAssert = Y.ArrayAssert,
ObjectAssert = Y.ObjectAssert,
function resetURL() {
if (html5) {
} else {
}
}
// -- Global Suite -------------------------------------------------------------
// -- Router Suite ---------------------------------------------------------
name: 'Router',
setUp: function () {
resetURL();
},
tearDown: function () {
resetURL();
}
});
// -- Router: Lifecycle ----------------------------------------------------
name: 'Lifecycle',
tearDown: function () {
delete this.router;
},
'initializer should set attributes based on config options': function () {
html5: false,
root: '/foo',
routes: [
]
});
},
'subclass with default routes should work': function () {
ATTRS: {
routes: {
value: [
]
}
}
}),
}
}));
// -- Router: Attributes ---------------------------------------------------
name: 'Attributes',
tearDown: function () {
delete this.router;
},
'`html5` attribute should have a default value': function () {
},
'`root` attribute should have a default value': function () {
},
'`routes` attribute should have a default value': function () {
},
'setting the `routes` attribute should reset all routes': function () {
]);
}
}));
// -- Router: Events -------------------------------------------------------
name: 'Events',
tearDown: function () {
delete this.router;
},
'`ready` event should fire when the router is ready to dispatch': function () {
var test = this,
on: {
ready: function (e) {
});
}
}
});
this.wait(1000);
},
'`ready` event should set e.dispatched to true if called after dispatch': function () {
var test = this,
on: {
initializedChange: function () {
this._dispatch('/fake', {});
},
ready: function (e) {
});
}
}
});
this.wait(1000);
}
}));
// -- Router: Methods ------------------------------------------------------
name: 'Methods',
setUp: function () {
},
tearDown: function () {
delete this.router;
delete this.errorFn;
delete this.throwFail;
},
'route() should add a route': function () {
function two() {}
},
'match() should return an array of routes that match the given path': function () {
function one() {}
function two() {}
function three() {}
},
'hasRoute() should return `true` if one or more routes match the given path': function () {
function noop () {}
},
'hasRoute() should support full URLs': function () {
function noop () {}
// Scheme-relative URL.
},
'hasRoute() should always return `false` for URLs with different origins': function () {
function noop () {}
},
'dispatch() should dispatch to the first route that matches the current URL': function () {
var test = this,
});
setTimeout(function () {
}, 1);
this.wait(1000);
},
'dispatch() should upgrade hash URLs to HTML5 URLs in HTML5 browsers': function () {
if (!html5) {
return;
}
var test = this,
});
});
this.wait(500);
},
'removeRoot() should remove the root URL from a given path': function () {
},
'removeRoot() should strip the origin ("http://foo.com") portion of the URL, if any': function () {
},
'replace() should replace the current history entry': function () {
var test = this,
});
});
// Wrapped in a setTimeout to make the async test work on iOS<5, which
// performs this action synchronously.
setTimeout(function () {
}, 1);
this.wait(1000);
},
'save() should create a new history entry': function () {
var test = this,
});
});
// Wrapped in a setTimeout to make the async test work on iOS<5, which
// performs this action synchronously.
setTimeout(function () {
}, 1);
this.wait(1000);
},
'consecutive save() calls should dispatch to the correct routes': function () {
var paths = [],
test = this,
});
});
});
});
// Wrapped in a setTimeout to make the async test work on iOS<5, which
// performs this action synchronously.
setTimeout(function () {
}, 1);
this.wait(2000);
},
'replace() should error when the URL is not from the same origin': function () {
test = this;
// We don't want the uncaught error line noise because we expect an
// error to be thrown, and it won't be caught because `save()` is async.
});
return true;
};
});
});
// Wrapped in a setTimeout to make the async test work on iOS<5, which
// performs this action synchronously.
setTimeout(function () {
}, 1);
this.wait(500);
},
'save() should error when the URL is not from the same origin': function () {
test = this;
// We don't want the uncaught error line noise because we expect an
// error to be thrown, and it won't be caught because `save()` is async.
});
return true;
};
});
});
// Wrapped in a setTimeout to make the async test work on iOS<5, which
// performs this action synchronously.
setTimeout(function () {
}, 1);
this.wait(500);
},
'_joinURL() should normalize "/" separators': function () {
},
'_dispatch() should pass `src` through to request object passed to route handlers': function () {
calls = 0,
src = 'API';
});
}
}));
// -- Router: Routes -------------------------------------------------------
name: 'Routes',
tearDown: function () {
delete this.router;
delete this.router2;
},
'routes should be called in the context of the router': function () {
var calls = 0,
});
calls += 1;
};
},
'routes should receive a request object, response object, and `next` function as params': function () {
var calls = 0,
calls += 1;
});
// Duckpunching _getQuery so we can test req.query.
return 'bar=baz%20quux&moo';
};
},
'request object should contain captured route parameters': function () {
var calls = 0,
calls += 1;
});
calls += 1;
});
calls += 1;
});
},
'calling `res()` should have the same result as calling `next()`': function () {
var calls = 0;
calls += 1;
res();
});
calls += 1;
next();
});
calls += 1;
});
},
'calling `next()` should pass control to the next matching route': function () {
var calls = 0,
calls += 1;
next();
});
calls += 1;
next();
});
calls += 1;
});
calls += 1;
});
},
'"*" should be a catch-all route': function () {
var calls = 0,
calls += 1;
});
},
'routes containing a "*" should match the segments which follow it': function () {
var calls = 0,
calls += 1;
});
calls += 1;
});
calls += 1;
});
},
'multiple routers should be able to coexist and have duplicate route handlers': function () {
var calls = 0,
calls += 1;
});
calls += 1;
});
this.wait(function () {
}, 200);
}
}));
}, '@VERSION@', {
});