UnitTC: Additional unit testcases have been added
[platform/framework/web/web-ui-fw.git] / tests / additional-unit-tests / handler / handler-tests.js
1 /*
2  * Unit Test: Handler
3  *
4  * Wonseop Kim <wonseop.kim@samsung.com>
5  */
6 /*jslint browser: true*/
7 /*global $,  jQuery,  test,  equal,  ok*/
8 ( function ( $ ) {
9         module("Handler");
10
11         var unit_handler = function ( widget ) {
12                 var elem = ".ui-handler",
13                         handler;
14
15                 /* Create */
16                 widget.scrollview( );
17                 handler = widget.find( elem );
18                 ok( ( handler.length > 0 ), "Create");
19
20                 /* API */
21                 widget.scrollview("enableHandler",  false );
22                 ok( handler.is(":hidden"), "API: enableHandler( false )");
23                 widget.scrollview("enableHandler",  true );
24                 ok( handler.is(":visible"), "API: enableHandler( true )");
25         };
26
27         test("handler",  function ( ) {
28                 $('#handler0').page( );
29                 unit_handler( $("#handlerY") );
30         } );
31
32         test( "handler - dynamic",  function ( ) {
33                 var listHTML = '<div id= "handlerY"data-role= "content"data-scroll= "y"data-handler= "true">' +
34                                                                         '<ul data-role= "listview">                                                                                     ' +
35                                                                                 '<li><a href= "#">Graham Smith</a></li>' +
36                                                                                 '<li><a href= "#">Greta Peete</a></li>' +
37                                                                                 '<li data-role= "list-divider">H</li>' +
38                                                                                 '<li><a href= "#">Harvey Walls</a></li>' +
39                                                                         '</ul>' +
40                                                                 '</div>';
41
42                 $('#handler1').page( );
43                 $('#handler1').find(":jqmData(role=content)").empty( );
44                 $('#handler1').find(":jqmData(role=content)").append( listHTML ).trigger('create') ;
45                 unit_handler( $("#handlerY") );
46         } );
47 }( jQuery ) );