@@ -9,8 +9,10 @@ define([
9
9
] , function ( $ , SwatchRenderer ) {
10
10
'use strict' ;
11
11
12
- describe ( 'Testing SwatchRenderer Widget' , function ( ) {
12
+ describe ( 'Testing "_RenderSwatchOptions" method of SwatchRenderer Widget' , function ( ) {
13
13
var widget ,
14
+ html ,
15
+ optionConfig ,
14
16
attribute ,
15
17
optionId = 2 ,
16
18
swathImageHeight = '60' ,
@@ -22,11 +24,21 @@ define([
22
24
widget = new SwatchRenderer ( ) ;
23
25
attribute = {
24
26
id : 1 ,
25
- options : [ { id : optionId } ]
27
+ options : [ {
28
+ id : optionId
29
+ } ]
26
30
} ;
27
31
widget . options = {
28
- classes : { optionClass : "swatch-option" } ,
29
- jsonSwatchConfig : { 1 : { 2 : { type : 2 } } } ,
32
+ classes : {
33
+ optionClass : 'swatch-option'
34
+ } ,
35
+ jsonSwatchConfig : {
36
+ 1 : {
37
+ 2 : {
38
+ type : 2
39
+ }
40
+ }
41
+ } ,
30
42
jsonSwatchImageSizeConfig : {
31
43
swatchImage : {
32
44
width : swathImageWidth ,
@@ -38,39 +50,31 @@ define([
38
50
}
39
51
}
40
52
} ;
53
+ optionConfig = widget . options . jsonSwatchConfig [ attribute . id ] ;
54
+ html = $ ( widget . _RenderSwatchOptions ( attribute , 'option-label-control-id-1' ) ) [ 0 ] ;
41
55
} ) ;
42
56
43
- describe ( '"_RenderSwatchOptions" method' , function ( ) {
44
- var html ,
45
- optionConfig ;
46
-
47
- beforeEach ( function ( ) {
48
- optionConfig = widget . options . jsonSwatchConfig [ attribute . id ] ;
49
- html = $ ( widget . _RenderSwatchOptions ( attribute , 'option-label-control-id-1' ) ) [ 0 ] ;
50
- } ) ;
51
-
52
- it ( 'check if swatch config has attribute id' , function ( ) {
53
- expect ( widget . options . jsonSwatchConfig . hasOwnProperty ( attribute . id ) ) . toEqual ( true ) ;
54
- } ) ;
57
+ it ( 'check if swatch config has attribute id' , function ( ) {
58
+ expect ( widget . options . jsonSwatchConfig . hasOwnProperty ( attribute . id ) ) . toEqual ( true ) ;
59
+ } ) ;
55
60
56
- it ( 'check if option config has option id' , function ( ) {
57
- expect ( optionConfig . hasOwnProperty ( optionId ) ) . toEqual ( true ) ;
58
- } ) ;
61
+ it ( 'check if option config has option id' , function ( ) {
62
+ expect ( optionConfig . hasOwnProperty ( optionId ) ) . toEqual ( true ) ;
63
+ } ) ;
59
64
60
- it ( 'check swatch thumbnail image height attribute' , function ( ) {
61
- expect ( html . hasAttribute ( 'thumb-height' ) ) . toBe ( true ) ;
62
- expect ( html . getAttribute ( 'thumb-height' ) ) . toEqual ( swathThumbImageHeight ) ;
63
- } ) ;
65
+ it ( 'check swatch thumbnail image height attribute' , function ( ) {
66
+ expect ( html . hasAttribute ( 'thumb-height' ) ) . toBe ( true ) ;
67
+ expect ( html . getAttribute ( 'thumb-height' ) ) . toEqual ( swathThumbImageHeight ) ;
68
+ } ) ;
64
69
65
- it ( 'check swatch thumbnail image width attribute' , function ( ) {
66
- expect ( html . hasAttribute ( 'thumb-width' ) ) . toBe ( true ) ;
67
- expect ( html . getAttribute ( 'thumb-width' ) ) . toEqual ( swathThumbImageWidth ) ;
68
- } ) ;
70
+ it ( 'check swatch thumbnail image width attribute' , function ( ) {
71
+ expect ( html . hasAttribute ( 'thumb-width' ) ) . toBe ( true ) ;
72
+ expect ( html . getAttribute ( 'thumb-width' ) ) . toEqual ( swathThumbImageWidth ) ;
73
+ } ) ;
69
74
70
- it ( 'check swatch image styles' , function ( ) {
71
- expect ( html . style . height ) . toEqual ( swathImageHeight + 'px' ) ;
72
- expect ( html . style . width ) . toEqual ( swathImageWidth + 'px' ) ;
73
- } ) ;
75
+ it ( 'check swatch image styles' , function ( ) {
76
+ expect ( html . style . height ) . toEqual ( swathImageHeight + 'px' ) ;
77
+ expect ( html . style . width ) . toEqual ( swathImageWidth + 'px' ) ;
74
78
} ) ;
75
79
} ) ;
76
80
} ) ;
0 commit comments