Skip to content
This repository was archived by the owner on Sep 20, 2020. It is now read-only.

Commit 41c0d7f

Browse files
author
christhielen
committed
chore(*): Run test suite against 0.2.14 and 0.2.15. closes #234
1 parent 7631a42 commit 41c0d7f

File tree

1 file changed

+55
-23
lines changed

1 file changed

+55
-23
lines changed

test/stickySpec.js

Lines changed: 55 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,30 @@ describe('stickyState', function () {
3131
return newStates;
3232
}
3333

34+
function getNestedStickyStates() {
35+
var newStates = {};
36+
newStates['aside'] = {};
37+
newStates['A'] = {sticky: true, deepStateRedirect: true, views: { 'A@': {} }};
38+
39+
newStates['A._1'] = {sticky: true, deepStateRedirect: true, views: { '_1@A': {} }};
40+
newStates['A._2'] = {sticky: true, deepStateRedirect: true, views: { '_2@A': {} }};
41+
newStates['A._3'] = {sticky: true, views: { '_3@A': {} }};
42+
43+
newStates['A._1.__1'] = {};
44+
newStates['A._1.__2'] = {};
45+
newStates['A._2.__1'] = {};
46+
newStates['A._2.__2'] = {};
47+
newStates['A._3.__1'] = { views: { '__1@A._3': {} } };
48+
newStates['A._3.__2'] = { views: { '__2@A._3': {} } };
49+
50+
newStates['A._1.__1.B'] = {};
51+
newStates['A._1.__1.B.___1'] = {sticky: true, views: { '___1@A._1.__1.B': {} }};
52+
newStates['A._1.__1.B.___2'] = {sticky: true, views: { '___2@A._1.__1.B': {} }};
53+
newStates['A._1.__1.B.___3'] = {sticky: true, views: { '___3@A._1.__1.B': {} }};
54+
55+
return newStates;
56+
}
57+
3458
beforeEach(module('ct.ui.router.extras.sticky', function ($stateProvider, $stickyStateProvider) {
3559
_stateProvider = $stateProvider;
3660
_stickyStateProvider = $stickyStateProvider;
@@ -273,28 +297,6 @@ describe('stickyState', function () {
273297
ssReset(getNestedStickyStates(), _stateProvider);
274298
});
275299

276-
function getNestedStickyStates() {
277-
var newStates = {};
278-
newStates['aside'] = {};
279-
newStates['A'] = {sticky: true, deepStateRedirect: true, views: { 'A@': {} }};
280-
281-
newStates['A._1'] = {sticky: true, deepStateRedirect: true, views: { '_1@A': {} }};
282-
newStates['A._2'] = {sticky: true, deepStateRedirect: true, views: { '_2@A': {} }};
283-
newStates['A._3'] = {sticky: true, views: { '_3@A': {} }};
284-
285-
newStates['A._1.__1'] = {};
286-
newStates['A._2.__2'] = {};
287-
newStates['A._3.__1'] = { views: { '__1@A._3': {} } };
288-
newStates['A._3.__2'] = { views: { '__2@A._3': {} } };
289-
290-
newStates['A._1.__1.B'] = {};
291-
newStates['A._1.__1.B.___1'] = {sticky: true, views: { '___1@A._1.__1.B': {} }};
292-
newStates['A._1.__1.B.___2'] = {sticky: true, views: { '___2@A._1.__1.B': {} }};
293-
newStates['A._1.__1.B.___3'] = {sticky: true, views: { '___3@A._1.__1.B': {} }};
294-
295-
return newStates;
296-
}
297-
298300
it ('should inactivate sticky state tabs_tab1 when transitioning back to A', function () {
299301
testGo('aside', { entered: ['aside'] });
300302
testGo('A._1.__1.B.___1', { exited: ['aside'], entered: pathFrom('A', 'A._1.__1.B.___1') });
@@ -325,7 +327,7 @@ describe('stickyState', function () {
325327
it("should not exit inactive child states", function() {
326328
testGo('A._3.__1', { entered: pathFrom('A', 'A._3.__1') });
327329
testGo('A._2', { inactivated: pathFrom('A._3.__1', 'A._3'), entered: "A._2" });
328-
testGo('A._3.__2', { reactivated: "A._3", inactivated: "A._2", entered: "A._3.__2" });
330+
testGo('A._3.__2', { reactivated: "A._3", inactivated: "A._2", entered: "A._3.__2", exited: "A._3.__1" });
329331
});
330332
})
331333
});
@@ -468,6 +470,36 @@ describe('stickyState', function () {
468470
expect($stickyState.getInactiveStates().length).toBe(0);
469471
});
470472
});
473+
474+
describe("transitions to sibling of inactive state", function() {
475+
// Tests for issue #217
476+
477+
beforeEach(function() {
478+
ssReset(getNestedStickyStates(), _stateProvider);
479+
});
480+
481+
it("should exit the inactive state", function() {
482+
testGo('A._1.__1', { entered: ['A', 'A._1', 'A._1.__1']});
483+
testGo('A._2.__1', { entered: ['A._2', 'A._2.__1'], inactivated: ['A._1.__1', 'A._1']});
484+
testGo('A._1.__2', {
485+
entered: ['A._1.__2'],
486+
exited: ['A._1.__1'],
487+
reactivated: ['A._1'],
488+
inactivated: ['A._2.__1', 'A._2']
489+
});
490+
});
491+
492+
it("should exit the inactive state tree", function() {
493+
testGo('A._1.__1.B', { entered: ['A', 'A._1', 'A._1.__1', 'A._1.__1.B']});
494+
testGo('A._2.__1', { entered: ['A._2', 'A._2.__1'], inactivated: ['A._1.__1.B', 'A._1.__1', 'A._1']});
495+
testGo('A._1.__2', {
496+
entered: ['A._1.__2'],
497+
exited: ['A._1.__1.B', 'A._1.__1'],
498+
reactivated: ['A._1'],
499+
inactivated: ['A._2.__1', 'A._2']
500+
});
501+
});
502+
})
471503
});
472504

473505
describe('stickyState+ui-sref-active', function () {

0 commit comments

Comments
 (0)