@@ -20,7 +20,7 @@ define([
20
20
} ,
21
21
defaultContext = require . s . contexts . _ ,
22
22
menuSelector = '[data-action="navigation"] > ul' ,
23
- menuItem = $ ( '<li class="level0"><a href="http://localhost.com/cat1.html" id="ui-id-3" >Cat1</a></li>' ) [ 0 ] ,
23
+ menuItem = $ ( '<li class="level0"><a href="http://localhost.com/cat1.html">Cat1</a></li>' ) [ 0 ] ,
24
24
25
25
/**
26
26
* Create context object.
@@ -107,14 +107,14 @@ define([
107
107
} ) ;
108
108
109
109
it ( 'Check _getCategoryCrumb call' , function ( ) {
110
- var item = $ ( '<a href="http://localhost.com/cat1.html" id="ui-id-3" >Cat1</a>' ) ;
110
+ var item = $ ( '<a href="http://localhost.com/cat1.html">Cat1</a>' ) ;
111
111
112
112
expect ( widget ) . toBeDefined ( ) ;
113
113
expect ( widget ) . toEqual ( jasmine . any ( Function ) ) ;
114
114
expect ( widget . prototype . _getCategoryCrumb ) . toBeDefined ( ) ;
115
115
expect ( widget . prototype . _getCategoryCrumb ( item ) ) . toEqual ( jasmine . objectContaining (
116
116
{
117
- 'name' : 'category3 ' ,
117
+ 'name' : 'category ' ,
118
118
'label' : 'Cat1' ,
119
119
'link' : 'http://localhost.com/cat1.html'
120
120
}
@@ -223,7 +223,7 @@ define([
223
223
expect ( result . length ) . toBe ( 1 ) ;
224
224
expect ( result [ 0 ] ) . toEqual ( jasmine . objectContaining (
225
225
{
226
- 'name' : 'category3 ' ,
226
+ 'name' : 'category ' ,
227
227
'label' : 'Cat1' ,
228
228
'link' : 'http://localhost.com/cat1.html'
229
229
}
@@ -234,10 +234,10 @@ define([
234
234
var result ,
235
235
menuItems = $ (
236
236
'<li class="level0 nav-1">' +
237
- '<a href="http://localhost.com/cat1.html" id="ui-id-3" >cat1</a>' +
237
+ '<a href="http://localhost.com/cat1.html">cat1</a>' +
238
238
'<ul>' +
239
239
'<li class="level1 nav-1-1">' +
240
- '<a href="http://localhost.com/cat1/cat21.html" id="ui-id-9" >cat21</a>' +
240
+ '<a href="http://localhost.com/cat1/cat21.html">cat21</a>' +
241
241
'</li>' +
242
242
'</ul>' +
243
243
'</li>'
@@ -253,59 +253,17 @@ define([
253
253
254
254
context = createContext ( widget . prototype ) ;
255
255
getParentMenuHandler = widget . prototype . _getParentMenuItem . bind ( context ) ;
256
- result = getParentMenuHandler ( $ ( '#ui-id-9 ' ) ) ;
256
+ result = getParentMenuHandler ( $ ( '[href="http://localhost.com/cat1/cat21.html"] ' ) ) ;
257
257
258
258
expect ( result ) . toBeDefined ( ) ;
259
259
expect ( result . length ) . toBe ( 1 ) ;
260
260
expect ( result [ 0 ] . tagName . toLowerCase ( ) ) . toEqual ( 'a' ) ;
261
- expect ( result . attr ( 'id ' ) ) . toEqual ( 'ui-id-3 ' ) ;
261
+ expect ( result . attr ( 'href ' ) ) . toEqual ( 'http://localhost.com/cat1.html ' ) ;
262
262
263
- result = getParentMenuHandler ( $ ( '#ui-id-3 ' ) ) ;
263
+ result = getParentMenuHandler ( $ ( '[href="http://localhost.com/cat1.html"] ' ) ) ;
264
264
265
265
expect ( result ) . toBeNull ( ) ;
266
266
} ) ;
267
-
268
- it ( 'Check _init event binding' , function ( ) {
269
- var context ,
270
- initMethod ;
271
-
272
- expect ( parentWidget ) . toBeDefined ( ) ;
273
- expect ( parentWidget ) . toEqual ( jasmine . any ( Function ) ) ;
274
-
275
- context = createContext ( widget . prototype ) ;
276
- initMethod = widget . prototype . _init . bind ( context ) ;
277
-
278
- spyOn ( parentWidget . prototype , '_init' ) ;
279
- spyOn ( widget . prototype , '_on' ) . and . returnValue ( widget ) ;
280
-
281
- initMethod ( ) ;
282
-
283
- expect ( parentWidget . prototype . _init ) . not . toHaveBeenCalled ( ) ;
284
- expect ( widget . prototype . _on ) . toHaveBeenCalledWith (
285
- jasmine . objectContaining ( {
286
- selector : menuSelector
287
- } ) ,
288
- {
289
- 'menucreate' : jasmine . any ( Function )
290
- }
291
- ) ;
292
- } ) ;
293
-
294
- it ( 'Check parent _init call' , function ( ) {
295
- var context ,
296
- initMethod ;
297
-
298
- expect ( parentWidget ) . toBeDefined ( ) ;
299
- expect ( parentWidget ) . toEqual ( jasmine . any ( Function ) ) ;
300
-
301
- context = createContext ( widget . prototype ) ;
302
- initMethod = widget . prototype . _init . bind ( context ) ;
303
- spyOn ( parentWidget . prototype , '_init' ) ;
304
-
305
- jQuery ( menuSelector ) . attr ( 'data-mage-menu' , '<li></li>' ) ;
306
- initMethod ( ) ;
307
- expect ( parentWidget . prototype . _init ) . toHaveBeenCalled ( ) ;
308
- } ) ;
309
267
} ) ;
310
268
} ) ;
311
269
} ) ;
0 commit comments