summaryrefslogtreecommitdiff
path: root/tests/unit-tests/loader/loader-tests.js
blob: a2ebd802b8e9738f14ac0c618134316150bbdeb7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
/**
 * Loader test
 *
 * Youmin Ha <youmin.ha@samsung.com>
 *
 */
( function ( $ ) {
	$.mobile.defaultTransition = "none";

	module( "Loader" );

	var tizen = $.tizen.__tizen__;

	test( "util.getScaleFactor()", function ( ) {
		var util = tizen.util,
			expected = 1,
			defaultWidth = 720;

		if( window.scale ) {
			expected = window.scale;
		} else {
			expected = screen.width / defaultWidth;
			if( expected > 1 ) {	// Don't allow expansion
				expected = 1;
			}
		}

		// Test value
		equal( util.getScaleFactor( ), expected, "Scale factor value should calculated properly." );
	} );

	test( "util.isMobileBrowser()", function ( ) {
		var appVersion = window.navigator.appVersion,
			mobile = appVersion.match( "Mobile" ),
			isMobile = mobile ? true : false;

		equal( tizen.util.isMobileBrowser(), isMobile, "Mobile browser must be detected." );

		/* NOTE:
		 * Is this test OK? How are both cases(mobile/non-mobile) tested?
		 */
	} );

	test( "css.addElementToHead()", function ( ) {
		var css = tizen.css,
			scarecrow = $( '<meta name="scarecrow" />' ),
			selected;

		css.addElementToHead( scarecrow );
		selected = $('head').children('meta[name=scarecrow]');
		ok( selected.length > 0, 'Object must be added to header.' );
	} );
} ) ( jQuery );