6
6
7
7
module ( "Fetchlinks" , {
8
8
setup : function ( ) {
9
- //
9
+ // $.testHelper.openPage("#fetchlink-test1");
10
10
}
11
11
} ) ;
12
12
15
15
16
16
$ . testHelper . pageSequence ( [
17
17
function ( ) {
18
- $ ( '.foo ' ) . trigger ( 'click' ) ;
18
+ $ ( '.standalone ' ) . trigger ( 'click' ) ;
19
19
} ,
20
20
function ( ) {
21
21
ok ( targetContents !== $ ( '.loadinto' ) . html ( ) ) ;
24
24
] ) ;
25
25
} ) ;
26
26
27
- asyncTest ( "Clicking a fetchlink replaces previously loaded content with remote content." , function ( ) {
27
+ asyncTest ( "Clicking a grouped fetchlink loads remote content." , function ( ) {
28
28
var targetContents = $ ( '.loadinto' ) . html ( ) ;
29
29
30
30
$ . testHelper . pageSequence ( [
38
38
] ) ;
39
39
} ) ;
40
40
41
- asyncTest ( "Elements are properly enhanced after being fetched ." , function ( ) {
41
+ asyncTest ( "When no remote fragment is specified, the remote “page” element’s contents are pulled in instead ." , function ( ) {
42
42
$ . testHelper . pageSequence ( [
43
43
function ( ) {
44
- $ ( '.baz ' ) . trigger ( 'click' ) ;
44
+ $ ( '.remote-page ' ) . trigger ( 'click' ) ;
45
45
} ,
46
46
function ( ) {
47
- ok ( $ ( '[data-nstest-role="header"]' ) . hasClass ( 'ui-header' ) , "Page header is enhanced." ) ;
48
- ok ( $ ( '[data-nstest-role="content"]' ) . hasClass ( 'ui-content' ) , "Page content is enhanced." ) ;
49
- ok ( $ ( '[data-nstest-role="footer"]' ) . hasClass ( 'ui-footer' ) , "Page footer is enhanced." ) ;
50
- ok ( $ ( '[data-nstest-role="button"]' ) . hasClass ( 'ui-btn' ) , "A link with a role of “button” is enhanced." ) ;
51
- ok ( $ ( '[data-nstest-role="slider"]' ) . hasClass ( 'ui-slider-switch' ) , "Toggles are enhanced." ) ;
52
- ok ( $ ( '#test-slider' ) . hasClass ( 'ui-slider-input' ) , "Slider widgets are enhanced." ) ;
47
+ var headerFirst = $ ( '.loadinto' ) . find ( 'div:first' ) . attr ( 'data-nstest-role' ) === 'header' ,
48
+ footerLast = $ ( '.loadinto' ) . find ( 'div:last' ) . attr ( 'data-nstest-role' ) === 'footer' ;
49
+
50
+ ok ( headerFirst && footerLast , "First and last items within the page wrapper match the first and last items in the target container." ) ;
51
+ start ( ) ;
52
+ }
53
+ ] ) ;
54
+ } ) ;
55
+
56
+ asyncTest ( "Elements are properly enhanced after being fetched." , function ( ) {
57
+ $ . testHelper . pageSequence ( [
58
+ function ( ) {
59
+ ok ( $ ( '.loadinto' ) . find ( '[data-nstest-role="header"]' ) . hasClass ( 'ui-header' ) , "Page header is enhanced." ) ;
60
+ ok ( $ ( '.loadinto' ) . find ( '[data-nstest-role="content"]' ) . hasClass ( 'ui-content' ) , "Page content is enhanced." ) ;
61
+ ok ( $ ( '.loadinto' ) . find ( '[data-nstest-role="footer"]' ) . hasClass ( 'ui-footer' ) , "Page footer is enhanced." ) ;
62
+ ok ( $ ( '.loadinto' ) . find ( '[data-nstest-role="button"]' ) . hasClass ( 'ui-btn' ) , "A link with a role of “button” is enhanced." ) ;
63
+ ok ( $ ( '.loadinto' ) . find ( '[data-nstest-role="slider"]' ) . hasClass ( 'ui-slider-switch' ) , "Toggles are enhanced." ) ;
64
+ ok ( $ ( '.loadinto' ) . find ( '#test-slider' ) . hasClass ( 'ui-slider-input' ) , "Slider widgets are enhanced." ) ;
53
65
54
66
start ( ) ;
55
67
}
56
68
] ) ;
57
69
} ) ;
58
70
71
+ asyncTest ( "Fetchlinks within remote content function normally." , function ( ) {
72
+ var targetContents = $ ( '.secondtarget' ) . html ( ) ;
73
+
74
+ $ . testHelper . pageSequence ( [
75
+ function ( ) {
76
+ $ ( '.remote-fetchlink' ) . trigger ( 'click' ) ;
77
+ } ,
78
+ function ( ) {
79
+ ok ( $ ( '.loadinto' ) . html ( ) !== targetContents , "Target container has been updated with remote content." ) ;
80
+ start ( ) ;
81
+ }
82
+ ] ) ;
83
+ } ) ;
84
+
85
+
59
86
60
87
61
88
} ) ( jQuery ) ;
0 commit comments