forked from TehShrike/abstract-state-router
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add breaking test for global resolve data for Issue TehShrike#48
- Loading branch information
1 parent
ec0fc9d
commit 58578d3
Showing
1 changed file
with
31 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
var test = require('tape-catch') | ||
var getTestState = require('./helpers/test-state-factory') | ||
|
||
test('global pre-loaded data is available in activate function', function(t) { | ||
var testState = getTestState(t) | ||
var stateRouter = testState.stateRouter | ||
|
||
// the global pre-loaded object | ||
abstractStateRouterPreLoadedResolveDataMap = { // jshint ignore:line | ||
pants: { | ||
size: 'huge' | ||
} | ||
} | ||
|
||
t.plan(1) | ||
|
||
stateRouter.addState({ | ||
name: 'pants', | ||
template: '', | ||
resolve: function(data, parameters, cb) { | ||
t.fail('resolve has pre-loaded data so should not run') | ||
cb(false) | ||
}, | ||
activate: function(context) { | ||
t.equal(context.content.size, 'huge', 'activate should access pre-loaded data') | ||
t.end() | ||
} | ||
}) | ||
|
||
stateRouter.go('pants') | ||
}) |