[dw-free] Revamp /update
[commit: http://hg.dwscoalition.org/dw-free/rev/e60dcfa2823e]
http://bugs.dwscoalition.org/show_bug.cgi?id=2524
Additional tests for things we know should succeed and fail.
Patch by
fu.
Files modified:
http://bugs.dwscoalition.org/show_bug.cgi?id=2524
Additional tests for things we know should succeed and fail.
Patch by
![[personal profile]](https://www.dreamwidth.org/img/silk/identity/user.png)
Files modified:
- views/dev/tests/tagselector.html
- views/dev/tests/tagselector.js
-------------------------------------------------------------------------------- diff -r bc811ce8a136 -r e60dcfa2823e views/dev/tests/tagselector.html --- a/views/dev/tests/tagselector.html Thu Dec 22 17:57:52 2011 +0800 +++ b/views/dev/tests/tagselector.html Thu Dec 22 18:02:33 2011 +0800 @@ -1,3 +1,3 @@ <div> -<textarea></textarea> +<textarea id="taglist"></textarea> </div> diff -r bc811ce8a136 -r e60dcfa2823e views/dev/tests/tagselector.js --- a/views/dev/tests/tagselector.js Thu Dec 22 17:57:52 2011 +0800 +++ b/views/dev/tests/tagselector.js Thu Dec 22 18:02:33 2011 +0800 @@ -11,13 +11,50 @@ }); module( "jquery" ); -test( "initialize tagselector", function() { +test( "initialize tagselector", 3, function() { $("textarea").tagselector(); + equal($("button").length, 1); - expect(1); + equal($(".tagselector.ui-widget").length, 0); + $("button").click(); + equal($(".tagselector.ui-widget").length, 1); - equal($("button").length, 1); + $(".tagselector.ui-widget").hide(); } ); +test( "test tag input", 2, function() { + // test data + var tags = [ + "\"something in quotes\"", + "#etc","$test","+test",":test", + "<strong>abc</strong>", + "1337"]; + // we expect that this set of input will break the selector + // (so we must fix this at a server level) + var breaking = [ 1337 ]; + // FIXME: needs to be more generic + var tags_data = { currentCache: "foo", + cache: { "foo": tags, "breaking": breaking }, + cachemap: {}, + tagslist: [] }; + $("textarea").data("autocompletewithunknown", tags_data); + + $("textarea").tagselector(); + $("button").click(); + + equal($(".tagselector.ui-widget :checkbox").length, tags.length); + $("#tagselector_select").click(); // close the dialog + + raises(function() { + tags_data.currentCache = "breaking"; + $("textarea").tagselector(); + $("button").click(); + }, /has no method 'replace'/, "Confirm kind of input that can break the tagselector"); + + $(".tagselector.ui-widget").hide(); +}); + + + --------------------------------------------------------------------------------