UnitTC: Additional unit testcases have been added
[platform/framework/web/web-ui-fw.git] / tests / additional-unit-tests / gallery3d / gallery3d-tests.js
1 /*
2  * Unit Test: Gallery3d
3  *
4  * Wonseop Kim <wonseop.kim@samsung.com>
5  */
6
7 (function ($) {
8         $.mobile.defaultTransition = "none";
9
10         module("Galley3d");
11
12         asyncTest( "create & select", function() {
13                 var widget = $( "#galley3dTest1" ),
14                         imageList = [],
15                         path = widget.attr( "data-json-url" ),
16                         key = widget.attr( "data-json-key" ),
17                         elem = "ui-gallery3d";
18
19                 $.ajax({
20                         async : false,
21                         url : path,
22                         dataType: "json",
23                         success : function ( result ) {
24                                 imageList = result[key];
25                         }
26                 });
27
28                 /* Create */
29                 widget.gallery3d();
30                 ok( widget.hasClass( elem ), "Create" );
31
32                 /* API */
33                 widget.gallery3d( "select", 1 );
34                 setTimeout( function () {
35                         equal( widget.gallery3d( "select" ), imageList[1].src, "API : select" );
36                         start();
37                 }, 2400 );
38         });
39
40         asyncTest( "remove", function() {
41                 var widget = $( "#galley3dTest2" ),
42                         imageList = [],
43                         path = widget.attr( "data-json-url" ),
44                         key = widget.attr( "data-json-key" ),
45                         currentSource;
46
47                 $.ajax({
48                         async : false,
49                         url : path,
50                         dataType: "json",
51                         success : function ( result ) {
52                                 imageList = result[key];
53                         }
54                 });
55
56                 widget.gallery3d();
57                 currentSource = widget.gallery3d( "select" );
58
59                 /* API */
60                 widget.gallery3d( "remove" );
61                 notEqual( widget.gallery3d( "select" ), currentSource, "API : remove" );
62                 start();
63         });
64
65         asyncTest( "move", function() {
66                 var widget = $( "#galley3dTest3" ),
67                         imageList = [],
68                         path = widget.attr( "data-json-url" ),
69                         key = widget.attr( "data-json-key" ),
70                         currentSource;
71
72                 $.ajax({
73                         async : false,
74                         url : path,
75                         dataType: "json",
76                         success : function ( result ) {
77                                 imageList = result[key];
78                         }
79                 });
80
81                 widget.gallery3d();
82                 currentSource = widget.gallery3d( "select" );
83
84                 /* API */
85                 widget.gallery3d( "moveNext" );
86                 setTimeout( function () {
87                         equal( widget.gallery3d( "select" ), imageList[1].src, "API : moveNext" );
88                         start();
89
90                         stop();
91                         widget.gallery3d( "movePrev" );
92                         setTimeout( function () {
93                                 equal( widget.gallery3d( "select" ), imageList[0].src, "API : movePrev" );
94                                 start();
95                         }, 300 );
96                 }, 2400 );
97         });
98
99 }( jQuery ));