aboutsummaryrefslogtreecommitdiffstats
path: root/tests/unit/resizable/resizable_methods.js
blob: 2b4c4256cb164fc8886d058cf4b1a7cbada9823e (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
55
56
57
58
59
60
61
62
63
64
/*
 * resizable_methods.js
 */
(function($) {

module("resizable: methods");

test("init", function() {
	expect(6);

	$("<div></div>").appendTo('body').resizable().remove();
	ok(true, '.resizable() called on element');

	$([]).resizable().remove();
	ok(true, '.resizable() called on empty collection');

	$('<div></div>').resizable().remove();
	ok(true, '.resizable() called on disconnected DOMElement');

	$('<div></div>').resizable().resizable("foo").remove();
	ok(true, 'arbitrary method called after init');

	el = $('<div></div>').resizable();
	var foo = el.resizable("option", "foo");
	el.remove();
	ok(true, 'arbitrary option getter after init');

	$('<div></div>').resizable().resizable("option", "foo", "bar").remove();
	ok(true, 'arbitrary option setter after init');
});

test("destroy", function() {
	$("<div></div>").appendTo('body').resizable().resizable("destroy").remove();
	ok(true, '.resizable("destroy") called on element');

	$([]).resizable().resizable("destroy").remove();
	ok(true, '.resizable("destroy") called on empty collection');

	$('<div></div>').resizable().resizable("destroy").remove();
	ok(true, '.resizable("destroy") called on disconnected DOMElement');

	$('<div></div>').resizable().resizable("destroy").resizable("foo").remove();
	ok(true, 'arbitrary method called after destroy');

	var expected = $('<div></div>').resizable(),
		actual = expected.resizable('destroy');
	equal(actual, expected, 'destroy is chainable');
});

test("enable", function() {
	var expected = $('<div></div>').resizable(),
		actual = expected.resizable('enable');
	equal(actual, expected, 'enable is chainable');
	ok(false, "missing test - untested code is broken code.");
});

test("disable", function() {
	var expected = $('<div></div>').resizable(),
		actual = expected.resizable('disable');
	equal(actual, expected, 'disable is chainable');
	ok(false, "missing test - untested code is broken code.");
});

})(jQuery);