@@ -13,6 +13,13 @@ define([
13
13
describe ( 'Testing FormKey Provider' , function ( ) {
14
14
var inputContainer ;
15
15
16
+ function getFormKeyCookie ( ) {
17
+ var nameEQ = 'form_key=' ,
18
+ cookieArr = document . cookie . split ( ';' ) ;
19
+
20
+ return cookieArr [ 0 ] . split ( nameEQ ) [ 1 ] ;
21
+ }
22
+
16
23
beforeEach ( function ( ) {
17
24
inputContainer = document . createElement ( 'input' ) ;
18
25
inputContainer . setAttribute ( 'value' , '' ) ;
@@ -44,19 +51,15 @@ define([
44
51
} ) ;
45
52
46
53
it ( 'widget gets value from input[form_key] in case cookie is empty is pagination cache enabled' , function ( ) {
47
- document . cookie = 'form_key= ; expires = Thu, 01 Jan 1970 00:00:00 GMT' ;
48
54
var formKey = 'TestInputStrings' ;
55
+
56
+ document . cookie = 'form_key= ; expires = Thu, 01 Jan 1970 00:00:00 GMT' ;
49
57
$ ( inputContainer ) . val ( formKey ) ;
50
58
formKeyInit ( { 'isPaginationCacheEnabled' : 1 } ) ;
59
+
51
60
expect ( $ ( inputContainer ) . val ( ) ) . toEqual ( jasmine . any ( String ) ) ;
52
61
expect ( $ ( inputContainer ) . val ( ) . length ) . toEqual ( 16 ) ;
53
62
expect ( formKey ) . toEqual ( getFormKeyCookie ( ) ) ;
54
63
} ) ;
55
-
56
- function getFormKeyCookie ( ) {
57
- var nameEQ = 'form_key=' ,
58
- cookieArr = document . cookie . split ( ';' ) ;
59
- return cookieArr [ 0 ] . split ( nameEQ ) [ 1 ] ;
60
- }
61
64
} ) ;
62
65
} ) ;
0 commit comments