File tree Expand file tree Collapse file tree 1 file changed +22
-0
lines changed Expand file tree Collapse file tree 1 file changed +22
-0
lines changed Original file line number Diff line number Diff line change 122
122
refute ( spyC . called ) ;
123
123
} ,
124
124
125
+ 'with parent topic argument, must clear all child subscriptions' : function ( ) {
126
+ var topic = TestHelper . getUniqueString ( ) ,
127
+ topicA = topic + '.a' ,
128
+ topicB = topic + '.a.b' ,
129
+ topicC = topic + '.a.b.c' ,
130
+ spyB = sinon . spy ( ) ,
131
+ spyC = sinon . spy ( ) ;
132
+
133
+ // subscribe only to children:
134
+ PubSub . subscribe ( topicB , spyB ) ;
135
+ PubSub . subscribe ( topicC , spyC ) ;
136
+
137
+ // but unsubscribe from a parent:
138
+ PubSub . unsubscribe ( topicA ) ;
139
+
140
+ PubSub . publishSync ( topicB , TestHelper . getUniqueString ( ) ) ;
141
+ PubSub . publishSync ( topicC , TestHelper . getUniqueString ( ) ) ;
142
+
143
+ refute ( spyB . called ) ;
144
+ refute ( spyC . called ) ;
145
+ } ,
146
+
125
147
'must not throw exception when unsubscribing as part of publishing' : function ( ) {
126
148
refute . exception ( function ( ) {
127
149
var topic = TestHelper . getUniqueString ( ) ,
You can’t perform that action at this time.
0 commit comments