| [ Index ] |
PHP Cross Reference of Drupal 6 (yi-drupal) |
[Summary view] [Print] [Text view]
1 /* 2 * slider_options.js 3 */ 4 (function($) { 5 6 function handle() { 7 return el.find(".ui-slider-handle"); 8 } 9 10 module("slider: options"); 11 12 test("animate", function() { 13 ok(false, "missing test - untested code is broken code."); 14 }); 15 16 test("max", function() { 17 el = $('<div></div>'); 18 19 options = { 20 max: 37, 21 min: 6, 22 orientation: 'horizontal', 23 step: 1, 24 value: 50 25 }; 26 27 el.slider(options); 28 ok(el.slider("option", "value") == options.value, "value option is not contained by max"); 29 ok(el.slider("value") == options.max, "value method is contained by max"); 30 el.slider('destroy'); 31 32 }); 33 34 test("min", function() { 35 el = $('<div></div>'); 36 37 options = { 38 max: 37, 39 min: 6, 40 orientation: 'vertical', 41 step: 1, 42 value: 2 43 }; 44 45 el.slider(options); 46 ok(el.slider("option", "value") == options.value, "value option is not contained by min"); 47 ok(el.slider("value") == options.min, "value method is contained by min"); 48 el.slider('destroy'); 49 50 }); 51 52 test("orientation", function() { 53 el = $('<div></div>'); 54 55 options = { 56 max: 2, 57 min: -2, 58 orientation: 'vertical', 59 value: 1 60 }; 61 62 var percentVal = (options.value - options.min) / (options.max - options.min) * 100; 63 64 el.slider(options).slider("option", "orientation", "horizontal"); 65 ok(el.is('.ui-slider-horizontal'), "horizontal slider has class .ui-slider-horizontal"); 66 ok(!el.is('.ui-slider-vertical'), "horizontal slider does not have class .ui-slider-vertical"); 67 equals(handle().css('left'), percentVal + '%', "horizontal slider handle is positioned with left: %"); 68 69 el.slider('destroy'); 70 71 options = { 72 max: 2, 73 min: -2, 74 orientation: 'horizontal', 75 value: -1 76 }; 77 78 var percentVal = (options.value - options.min) / (options.max - options.min) * 100; 79 80 el.slider(options).slider("option", "orientation", "vertical"); 81 ok(el.is('.ui-slider-vertical'), "vertical slider has class .ui-slider-vertical"); 82 ok(!el.is('.ui-slider-horizontal'), "vertical slider does not have class .ui-slider-horizontal"); 83 equals(handle().css('bottom'), percentVal + '%', "vertical slider handle is positioned with bottom: %"); 84 85 el.slider('destroy'); 86 87 }); 88 89 test("range", function() { 90 ok(false, "missing test - untested code is broken code."); 91 }); 92 93 test("step", function() { 94 ok(false, "missing test - untested code is broken code."); 95 }); 96 97 test("value", function() { 98 ok(false, "missing test - untested code is broken code."); 99 }); 100 101 test("values", function() { 102 ok(false, "missing test - untested code is broken code."); 103 }); 104 105 })(jQuery);
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
| Generated: Mon Jul 9 18:01:44 2012 | Cross-referenced by PHPXref 0.7 |