@@ -14,57 +14,54 @@ define([
14
14
} ) ;
15
15
16
16
describe ( '"preparedOptions" method' , function ( ) {
17
- it ( 'return empty array if sorting is disabled for the columns' , function ( ) {
18
- var columns = [ {
19
- sortable : false ,
20
- label : 'magento' ,
21
- index : 'name'
22
- } ] ,
23
- options = [ ] ;
17
+ it ( 'sort option will not available if sorting is disabled for the columns' , function ( ) {
18
+ var columns = {
19
+ sortable : false ,
20
+ label : 'magento' ,
21
+ index : 'name'
22
+ } ;
24
23
25
- sortByObj . preparedOptions ( columns ) ;
26
- expect ( sortByObj . options ) . toEqual ( options ) ;
24
+ sortByObj . preparedOptions ( [ columns ] ) ;
25
+ expect ( sortByObj . options [ 0 ] ) . toBeUndefined ( ) ;
26
+ expect ( sortByObj . options [ 0 ] ) . toBeUndefined ( ) ;
27
27
} ) ;
28
28
29
- it ( 'return array of options if sorting is enabled for the columns' , function ( ) {
30
- var columns = [ {
31
- sortable : true ,
32
- label : 'magento' ,
33
- index : 'name'
34
- } ] ,
35
- options = [ {
36
- value : 'name' ,
37
- label : 'magento'
38
- } ] ;
29
+ it ( 'sort option will available if sorting is enabled for the columns' , function ( ) {
30
+ var columns = {
31
+ sortable : true ,
32
+ label : 'magento' ,
33
+ index : 'name'
34
+ } ;
39
35
40
- sortByObj . preparedOptions ( columns ) ;
41
- expect ( sortByObj . options ) . toEqual ( options ) ;
36
+ sortByObj . preparedOptions ( [ columns ] ) ;
37
+ expect ( sortByObj . options [ 0 ] . value ) . toEqual ( 'name' ) ;
38
+ expect ( sortByObj . options [ 0 ] . label ) . toEqual ( 'magento' ) ;
42
39
} ) ;
43
40
44
- it ( 'return "isVisible" method true if column is sortable ' , function ( ) {
45
- var columns = [ {
46
- sortable : true ,
47
- label : 'magento' ,
48
- index : 'name'
49
- } ] ;
41
+ it ( 'return "isVisible" method true if sorting is enabled for column ' , function ( ) {
42
+ var columns = {
43
+ sortable : true ,
44
+ label : 'magento' ,
45
+ index : 'name'
46
+ } ;
50
47
51
- sortByObj . preparedOptions ( columns ) ;
48
+ sortByObj . preparedOptions ( [ columns ] ) ;
52
49
expect ( sortByObj . isVisible ( ) ) . toBeTruthy ( ) ;
53
50
} ) ;
54
51
55
- it ( 'return "isVisible" method false if column is sortable ' , function ( ) {
56
- var columns = [ {
52
+ it ( 'return "isVisible" method false if sorting is disabled for column ' , function ( ) {
53
+ var columns = {
57
54
sortable : false ,
58
55
label : 'magento' ,
59
56
index : 'name'
60
- } ] ;
57
+ } ;
61
58
62
- sortByObj . preparedOptions ( columns ) ;
59
+ sortByObj . preparedOptions ( [ columns ] ) ;
63
60
expect ( sortByObj . isVisible ( ) ) . toBeFalsy ( ) ;
64
61
} ) ;
65
62
} ) ;
66
63
describe ( '"applyChanges" method' , function ( ) {
67
- it ( 'return applied option ' , function ( ) {
64
+ it ( 'return applied options for sorting column ' , function ( ) {
68
65
var applied = {
69
66
field : 'selectedOption' ,
70
67
direction : 'desc'
0 commit comments