Changeset 4141
- Timestamp:
- 12/13/07 13:04:52 (1 year ago)
- Location:
- trunk/plugins/accordion/test
- Files:
-
- 2 modified
-
index.html (modified) (1 diff)
-
test.js (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/plugins/accordion/test/index.html
r3915 r4141 30 30 <div id="list1"> 31 31 <a>There is one obvious advantage:</a> 32 <p> 33 You've seen it coming!<br/> 34 Buy now and get nothing for free!<br/> 35 Well, at least no free beer. Perhaps a bear, if you can afford it. 36 </p> 32 <div> 33 <p> 34 You've seen it coming!<br/> 35 Buy now and get nothing for free!<br/> 36 Well, at least no free beer. Perhaps a bear, if you can afford it. 37 </p> 38 </div> 37 39 <a>Now that you've got...</a> 38 <p> 39 your bear, you have to admit it!<br/> 40 No, we aren't selling bears. 41 </p> 42 <p> 43 We could talk about renting one. 44 </p> 40 <div> 41 <p> 42 your bear, you have to admit it!<br/> 43 No, we aren't selling bears. 44 </p> 45 <p> 46 We could talk about renting one. 47 </p> 48 </div> 45 49 <a>Rent one bear, ...</a> 46 <p> 47 get two for three beer. 48 </p> 49 <p> 50 And now, for something completely different. 51 </p> 50 <div> 51 <p> 52 get two for three beer. 53 </p> 54 <p> 55 And now, for something completely different. 56 </p> 57 </div> 52 58 </div> 53 59 -
trunk/plugins/accordion/test/test.js
r3664 r4141 4 4 var args = $.makeArray(arguments).slice(1); 5 5 $.each(args, function(i, n) { 6 equals(n, accordion.find(" p").eq(i).is(":visible"));6 equals(n, accordion.find("div").eq(i).is(":visible")); 7 7 }); 8 8 } 9 9 10 10 test("basics", function() { 11 state($('#list1').accordion(), 1, 0, 0 , 0, 0);11 state($('#list1').accordion(), 1, 0, 0); 12 12 }); 13 13 … … 25 25 test("activate, numeric", function() { 26 26 var ac = $('#list1').accordion({ active: 1 }); 27 state(ac, 0, 1, 1, 0,0);27 state(ac, 0, 1, 0); 28 28 ac.activate(2); 29 state(ac, 0, 0, 0, 1,1);29 state(ac, 0, 0, 1); 30 30 ac.activate(0); 31 state(ac, 1, 0, 0 , 0, 0);31 state(ac, 1, 0, 0); 32 32 ac.activate(1); 33 state(ac, 0, 1, 1, 0,0);33 state(ac, 0, 1, 0); 34 34 ac.activate(2); 35 state(ac, 0, 0, 0, 1,1);35 state(ac, 0, 0, 1); 36 36 ac.activate(-1); 37 state(ac, 0, 0, 0, 1,1);37 state(ac, 0, 0, 1); 38 38 }); 39 39 40 40 test("activate, boolean and numeric, alwaysOpen:false", function() { 41 41 var ac = $('#list1').accordion({alwaysOpen: false}).activate(2); 42 state(ac, 0, 0, 0, 1, 1); 43 ok("x", "----") 44 ac.activate(false); 45 state(ac, 0, 0, 0, 0, 0); 42 state(ac, 0, 0, 1); 46 43 ok("x", "----") 47 44 ac.activate(0); 48 state(ac, 1, 0, 0 , 0, 0);45 state(ac, 1, 0, 0); 49 46 ok("x", "----") 50 47 ac.activate(-1); 51 state(ac, 0, 0, 0 , 0, 0);48 state(ac, 0, 0, 0); 52 49 }); 53 50 54 51 test("activate, boolean, alwaysOpen:true", function() { 55 52 var ac = $('#list1').accordion().activate(2); 56 state(ac, 0, 0, 0, 1,1);57 ac.activate( false);58 state(ac, 0, 0, 0, 1,1);53 state(ac, 0, 0, 1); 54 ac.activate(-1); 55 state(ac, 0, 0, 1); 59 56 }); 60 57 61 58 test("activate, string expression", function() { 62 59 var ac = $('#list1').accordion({ active: ":last" }); 63 state(ac, 0, 0, 0, 1,1);60 state(ac, 0, 0, 1); 64 61 ac.activate(":first"); 65 state(ac, 1, 0, 0 , 0, 0);62 state(ac, 1, 0, 0); 66 63 ac.activate(":eq(1)"); 67 state(ac, 0, 1, 1, 0,0);64 state(ac, 0, 1, 0); 68 65 ac.activate(":last"); 69 state(ac, 0, 0, 0, 1,1);66 state(ac, 0, 0, 1); 70 67 }); 71 68 72 69 test("activate, jQuery or DOM element", function() { 73 var ac = $('#list1').accordion({ active: $("#list1 h3:last") });74 state(ac, 0, 0, 0, 1,1);75 ac.activate($("#list1 h3:first"));76 state(ac, 1, 0, 0 , 0, 0);77 ac.activate($("#list1 h3")[1]);78 state(ac, 0, 1, 1, 0,0);70 var ac = $('#list1').accordion({ active: $("#list1 a:last") }); 71 state(ac, 0, 0, 1); 72 ac.activate($("#list1 a:first")); 73 state(ac, 1, 0, 0); 74 ac.activate($("#list1 a")[1]); 75 state(ac, 0, 1, 0); 79 76 });
