kea-rails 1.0.1 → 1.0.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (122) hide show
  1. checksums.yaml +4 -4
  2. data/lib/kea-rails/version.rb +1 -1
  3. data/vendor/assets/components/Keypress/LICENSE +191 -0
  4. data/vendor/assets/components/Keypress/README.md +78 -0
  5. data/vendor/assets/components/Keypress/bower.json +28 -0
  6. data/vendor/assets/components/Keypress/keypress-2.1.0.min.js +33 -0
  7. data/vendor/assets/components/Keypress/keypress.coffee +921 -0
  8. data/vendor/assets/components/Keypress/keypress.js +1132 -0
  9. data/vendor/assets/components/Keypress/package.json +15 -0
  10. data/vendor/assets/components/attachejs/attache-jquery.js +47 -0
  11. data/vendor/assets/components/attachejs/attache-knockout.js +56 -0
  12. data/vendor/assets/components/attachejs/attache.css +10 -0
  13. data/vendor/assets/components/attachejs/attache.js +589 -0
  14. data/vendor/assets/components/attachejs/bower.json +36 -0
  15. data/vendor/assets/components/humane-js/bower.json +8 -0
  16. data/vendor/assets/components/humane-js/changelog.md +165 -0
  17. data/vendor/assets/components/humane-js/humane.js +238 -0
  18. data/vendor/assets/components/humane-js/humane.min.js +11 -0
  19. data/vendor/assets/components/humane-js/index.html +190 -0
  20. data/vendor/assets/components/humane-js/package.json +25 -0
  21. data/vendor/assets/components/humane-js/readme.md +85 -0
  22. data/vendor/assets/components/humane-js/test/issue23.html +11 -0
  23. data/vendor/assets/components/humane-js/test/issue36.html +9 -0
  24. data/vendor/assets/components/humane-js/test/issue38.html +15 -0
  25. data/vendor/assets/components/humane-js/test/issue49.html +9 -0
  26. data/vendor/assets/components/humane-js/theme-src/bigbox.styl +65 -0
  27. data/vendor/assets/components/humane-js/theme-src/boldlight.styl +64 -0
  28. data/vendor/assets/components/humane-js/theme-src/jackedup.styl +69 -0
  29. data/vendor/assets/components/humane-js/theme-src/libnotify.styl +61 -0
  30. data/vendor/assets/components/humane-js/theme-src/original.styl +51 -0
  31. data/vendor/assets/components/humane-js/themes/bigbox.css +123 -0
  32. data/vendor/assets/components/humane-js/themes/boldlight.css +122 -0
  33. data/vendor/assets/components/humane-js/themes/flatty.css +94 -0
  34. data/vendor/assets/components/humane-js/themes/jackedup.css +123 -0
  35. data/vendor/assets/components/humane-js/themes/libnotify.css +115 -0
  36. data/vendor/assets/components/humane-js/themes/original.css +72 -0
  37. data/vendor/assets/components/knockout-sortable/README.md +129 -0
  38. data/vendor/assets/components/knockout-sortable/bower.json +15 -0
  39. data/vendor/assets/components/knockout-sortable/build/knockout-sortable.js +358 -0
  40. data/vendor/assets/components/knockout-sortable/build/knockout-sortable.min.js +2 -0
  41. data/vendor/assets/components/uri.js/README.md +437 -0
  42. data/vendor/assets/components/uri.js/URI.jquery.json +38 -0
  43. data/vendor/assets/components/uri.js/about-uris.html +156 -0
  44. data/vendor/assets/components/uri.js/build.html +66 -0
  45. data/vendor/assets/components/uri.js/build.js +78 -0
  46. data/vendor/assets/components/uri.js/component.json +15 -0
  47. data/vendor/assets/components/uri.js/contribute.md +11 -0
  48. data/vendor/assets/components/uri.js/docs.html +1280 -0
  49. data/vendor/assets/components/uri.js/index.html +173 -0
  50. data/vendor/assets/components/uri.js/jquery-1.10.2.min.js +6 -0
  51. data/vendor/assets/components/uri.js/jquery-1.7.2.min.js +4 -0
  52. data/vendor/assets/components/uri.js/jquery-1.8.2.min.js +2 -0
  53. data/vendor/assets/components/uri.js/jquery-1.9.1.min.js +5 -0
  54. data/vendor/assets/components/uri.js/jquery-uri-plugin.html +203 -0
  55. data/vendor/assets/components/uri.js/package.json +75 -0
  56. data/vendor/assets/components/uri.js/prettify/lang-apollo.js +2 -0
  57. data/vendor/assets/components/uri.js/prettify/lang-clj.js +18 -0
  58. data/vendor/assets/components/uri.js/prettify/lang-css.js +2 -0
  59. data/vendor/assets/components/uri.js/prettify/lang-go.js +1 -0
  60. data/vendor/assets/components/uri.js/prettify/lang-hs.js +2 -0
  61. data/vendor/assets/components/uri.js/prettify/lang-lisp.js +3 -0
  62. data/vendor/assets/components/uri.js/prettify/lang-lua.js +2 -0
  63. data/vendor/assets/components/uri.js/prettify/lang-ml.js +2 -0
  64. data/vendor/assets/components/uri.js/prettify/lang-n.js +4 -0
  65. data/vendor/assets/components/uri.js/prettify/lang-proto.js +1 -0
  66. data/vendor/assets/components/uri.js/prettify/lang-scala.js +2 -0
  67. data/vendor/assets/components/uri.js/prettify/lang-sql.js +2 -0
  68. data/vendor/assets/components/uri.js/prettify/lang-tex.js +1 -0
  69. data/vendor/assets/components/uri.js/prettify/lang-vb.js +2 -0
  70. data/vendor/assets/components/uri.js/prettify/lang-vhdl.js +3 -0
  71. data/vendor/assets/components/uri.js/prettify/lang-wiki.js +2 -0
  72. data/vendor/assets/components/uri.js/prettify/lang-xq.js +3 -0
  73. data/vendor/assets/components/uri.js/prettify/lang-yaml.js +2 -0
  74. data/vendor/assets/components/uri.js/prettify/prettify.css +1 -0
  75. data/vendor/assets/components/uri.js/prettify/prettify.js +28 -0
  76. data/vendor/assets/components/uri.js/prettify/prettify.sunburst.css +52 -0
  77. data/vendor/assets/components/uri.js/screen.css +167 -0
  78. data/vendor/assets/components/uri.js/screen.js +39 -0
  79. data/vendor/assets/components/uri.js/src/IPv6.js +185 -0
  80. data/vendor/assets/components/uri.js/src/SecondLevelDomains.js +220 -0
  81. data/vendor/assets/components/uri.js/src/URI.fragmentQuery.js +103 -0
  82. data/vendor/assets/components/uri.js/src/URI.fragmentURI.js +96 -0
  83. data/vendor/assets/components/uri.js/src/URI.js +1938 -0
  84. data/vendor/assets/components/uri.js/src/URI.min.js +81 -0
  85. data/vendor/assets/components/uri.js/src/URITemplate.js +494 -0
  86. data/vendor/assets/components/uri.js/src/jquery.URI.js +232 -0
  87. data/vendor/assets/components/uri.js/src/jquery.URI.min.js +7 -0
  88. data/vendor/assets/components/uri.js/src/punycode.js +508 -0
  89. data/vendor/assets/components/uri.js/test/index.html +26 -0
  90. data/vendor/assets/components/uri.js/test/pre_libs.js +4 -0
  91. data/vendor/assets/components/uri.js/test/qunit/qunit-composite.css +13 -0
  92. data/vendor/assets/components/uri.js/test/qunit/qunit-composite.js +167 -0
  93. data/vendor/assets/components/uri.js/test/qunit/qunit.css +244 -0
  94. data/vendor/assets/components/uri.js/test/qunit/qunit.js +2212 -0
  95. data/vendor/assets/components/uri.js/test/test.URI.html +26 -0
  96. data/vendor/assets/components/uri.js/test/test.fragmentQuery.html +31 -0
  97. data/vendor/assets/components/uri.js/test/test.fragmentURI.html +31 -0
  98. data/vendor/assets/components/uri.js/test/test.jQuery-1.10.html +31 -0
  99. data/vendor/assets/components/uri.js/test/test.jQuery-1.7.html +31 -0
  100. data/vendor/assets/components/uri.js/test/test.jQuery-1.8.html +31 -0
  101. data/vendor/assets/components/uri.js/test/test.jQuery-1.9.html +31 -0
  102. data/vendor/assets/components/uri.js/test/test.js +1409 -0
  103. data/vendor/assets/components/uri.js/test/test_fragmentQuery.js +57 -0
  104. data/vendor/assets/components/uri.js/test/test_fragmentURI.js +59 -0
  105. data/vendor/assets/components/uri.js/test/test_jim.js +143 -0
  106. data/vendor/assets/components/uri.js/test/test_jquery.js +138 -0
  107. data/vendor/assets/components/uri.js/test/test_template.js +385 -0
  108. data/vendor/assets/components/uri.js/test/urls.js +1236 -0
  109. data/vendor/assets/components/uri.js/uri-template.html +234 -0
  110. data/vendor/assets/components/uri.js/utils/SLDs.php +37 -0
  111. data/vendor/assets/components/uri.js/utils/sld.js +101 -0
  112. data/vendor/assets/components/veiljs/bower.json +36 -0
  113. data/vendor/assets/components/veiljs/veil-jquery.js +47 -0
  114. data/vendor/assets/components/veiljs/veil-knockout.js +55 -0
  115. data/vendor/assets/components/veiljs/veil.js +465 -0
  116. data/vendor/assets/javascripts/fuse.js +472 -0
  117. data/vendor/assets/javascripts/jquery-ui.js +3844 -0
  118. data/vendor/assets/javascripts/knockout-3.2.0-debug.js +5299 -0
  119. data/vendor/assets/javascripts/moment.js +1902 -0
  120. data/vendor/assets/javascripts/pikaday.js +896 -0
  121. data/vendor/assets/stylesheets/pikaday.css +171 -0
  122. metadata +120 -1
@@ -0,0 +1,57 @@
1
+ (function(){
2
+
3
+ module("URI.fragmentQuery");
4
+ test("storing query-data in fragment", function() {
5
+ var u = URI("http://example.org");
6
+
7
+ deepEqual(u.fragment(true), {}, "empty map for missing fragment");
8
+
9
+ u = URI("http://example.org/#");
10
+ deepEqual(u.fragment(true), {}, "empty map for empty fragment");
11
+
12
+ u = URI("http://example.org/#?hello=world");
13
+ deepEqual(u.fragment(true), {hello: "world"}, "reading data object");
14
+
15
+ u.fragment({bar: "foo"});
16
+ deepEqual(u.fragment(true), {bar: "foo"}, "setting data object");
17
+ equal(u.toString(), "http://example.org/#?bar=foo", "setting data object serialized");
18
+
19
+ u.addFragment("name", "value");
20
+ deepEqual(u.fragment(true), {bar: "foo", name: "value"}, "adding value");
21
+ equal(u.toString(), "http://example.org/#?bar=foo&name=value", "adding value serialized");
22
+
23
+ u.removeFragment("bar");
24
+ deepEqual(u.fragment(true), {name: "value"}, "removing value bar");
25
+ equal(u.toString(), "http://example.org/#?name=value", "removing value bar serialized");
26
+
27
+ u.removeFragment("name");
28
+ deepEqual(u.fragment(true), {}, "removing value name");
29
+ equal(u.toString(), "http://example.org/#?", "removing value name serialized");
30
+ });
31
+ test("fragmentPrefix", function() {
32
+ var u;
33
+
34
+ URI.fragmentPrefix = '!';
35
+ u = URI("http://example.org");
36
+ equal(u._parts.fragmentPrefix, '!', "init using global property");
37
+
38
+ u.fragment('#?hello=world');
39
+ equal(u.fragment(), "?hello=world", "unparsed ?");
40
+ deepEqual(u.fragment(true), {}, "parsing ? prefix");
41
+
42
+ u.fragment('#!hello=world');
43
+ equal(u.fragment(), "!hello=world", "unparsed !");
44
+ deepEqual(u.fragment(true), {hello: "world"}, "parsing ! prefix");
45
+
46
+ u.fragmentPrefix('§');
47
+ equal(u.fragment(), "!hello=world", "unparsed §");
48
+ deepEqual(u.fragment(true), {}, "parsing § prefix");
49
+
50
+ u.fragment('#§hello=world');
51
+ equal(u.fragment(), "§hello=world", "unparsed §");
52
+ deepEqual(u.fragment(true), {hello: "world"}, "parsing § prefix");
53
+
54
+ URI.fragmentPrefix = '?';
55
+ });
56
+
57
+ })();
@@ -0,0 +1,59 @@
1
+ (function(){
2
+
3
+ module("URI.fragmentURI");
4
+ test("storing URLs in fragment", function() {
5
+ var u = URI("http://example.org");
6
+ var f;
7
+
8
+ // var uri = URI("http://example.org/#!/foo/bar/baz.html");
9
+ // var furi = uri.fragment(true);
10
+ // furi.pathname() === '/foo/bar/baz.html';
11
+ // furi.pathname('/hello.html');
12
+ // uri.toString() === "http://example.org/#!/hello.html"
13
+
14
+ ok(u.fragment(true) instanceof URI, "URI instance for missing fragment");
15
+
16
+ u = URI("http://example.org/#");
17
+ ok(u.fragment(true) instanceof URI, "URI instance for empty fragment");
18
+
19
+ u = URI("http://example.org/#!/foo/bar/baz.html");
20
+ f = u.fragment(true);
21
+ equal(f.pathname(), "/foo/bar/baz.html", "reading path of FragmentURI");
22
+ equal(f.filename(), "baz.html", "reading filename of FragmentURI");
23
+
24
+ f.filename('foobar.txt');
25
+ equal(f.pathname(), "/foo/bar/foobar.txt", "modifying filename of FragmentURI");
26
+ equal(u.fragment(), "!/foo/bar/foobar.txt", "modifying fragment() through FragmentURI on original");
27
+ equal(u.toString(), "http://example.org/#!/foo/bar/foobar.txt", "modifying filename of FragmentURI on original");
28
+ });
29
+ test("fragmentPrefix", function() {
30
+ var u;
31
+
32
+ URI.fragmentPrefix = '?';
33
+ u = URI("http://example.org");
34
+ equal(u._parts.fragmentPrefix, '?', "init using global property");
35
+
36
+ u.fragment('#!/foo/bar/baz.html');
37
+ equal(u.fragment(), "!/foo/bar/baz.html", "unparsed ?");
38
+ ok(u.fragment(true) instanceof URI, "parsing ? prefix - is URI");
39
+ equal(u.fragment(true).toString(), "", "parsing ? prefix - result");
40
+
41
+ u.fragment('#?/foo/bar/baz.html');
42
+ equal(u.fragment(), "?/foo/bar/baz.html", "unparsed ?");
43
+ ok(u.fragment(true) instanceof URI, "parsing ? prefix - is URI");
44
+ equal(u.fragment(true).toString(), "/foo/bar/baz.html", "parsing ? prefix - result");
45
+
46
+ u.fragmentPrefix('§');
47
+ equal(u.fragment(), "?/foo/bar/baz.html", "unparsed §");
48
+ ok(u.fragment(true) instanceof URI, "parsing § prefix - is URI");
49
+ equal(u.fragment(true).toString(), "", "parsing § prefix - result");
50
+
51
+ u.fragment('#§/foo/bar/baz.html');
52
+ equal(u.fragment(), "§/foo/bar/baz.html", "unparsed §");
53
+ ok(u.fragment(true) instanceof URI, "parsing § prefix - is URI");
54
+ equal(u.fragment(true).toString(), "/foo/bar/baz.html", "parsing § prefix - result");
55
+
56
+ URI.fragmentPrefix = '!';
57
+ });
58
+
59
+ })();
@@ -0,0 +1,143 @@
1
+ /*
2
+ * What would jim do?
3
+ * more tests for border-edge cases
4
+ * Christian Harms.
5
+ *
6
+ * Note: I have no clue who or what jim is supposed to be. It might be something like the German DAU (dumbest possible user)
7
+ */
8
+ (function(){
9
+ module("injection");
10
+ test("protocol", function() {
11
+ var u = new URI("http://example.com/dir1/dir2/?query1=value1&query2=value2#hash");
12
+ raises(function() {
13
+ u.protocol("ftp://example.org");
14
+ }, TypeError, "Failing invalid characters");
15
+
16
+ u.protocol("ftp:");
17
+ equal(u.protocol(), "ftp", "protocol() has set invalid protocoll!");
18
+ equal(u.hostname(), "example.com", "protocol() has changed the hostname");
19
+ });
20
+ test("port", function() {
21
+ var u = new URI("http://example.com/dir1/dir2/?query1=value1&query2=value2#hash");
22
+ raises(function() {
23
+ u.port("99:example.org");
24
+ }, TypeError, "Failing invalid characters");
25
+
26
+ u.port(":99");
27
+ equal(u.hostname(), "example.com", "port() has modified hostname");
28
+ equal(u.port(), 99, "port() has set an invalid port");
29
+
30
+ u.port(false);
31
+ equal(u.port(), "", "port() has set an invalid port");
32
+
33
+ // RFC 3986 says nothing about "16-bit unsigned" http://tools.ietf.org/html/rfc3986#section-3.2.3
34
+ // u.href(new URI("http://example.com/"))
35
+ // u.port(65536);
36
+ // notEqual(u.port(), "65536", "port() has set to an non-valid value (A port number is a 16-bit unsigned integer)");
37
+
38
+ raises(function() {
39
+ u.port("-99");
40
+ }, TypeError, "Failing invalid characters");
41
+ });
42
+ test("domain", function() {
43
+ var u = new URI("http://example.com/dir1/dir2/?query1=value1&query2=value2#hash");
44
+
45
+ raises(function() {
46
+ u.domain("example.org/dir0/");
47
+ }, TypeError, "Failing invalid characters");
48
+
49
+ raises(function() {
50
+ u.domain("example.org:80");
51
+ }, TypeError, "Failing invalid characters");
52
+
53
+ raises(function() {
54
+ u.domain("foo@example.org");
55
+ }, TypeError, "Failing invalid characters");
56
+ });
57
+ test("subdomain", function() {
58
+ var u = new URI("http://example.com/dir1/dir2/?query1=value1&query2=value2#hash");
59
+
60
+ raises(function() {
61
+ u.subdomain("example.org/dir0/");
62
+ }, TypeError, "Failing invalid characters");
63
+
64
+ raises(function() {
65
+ u.subdomain("example.org:80");
66
+ }, TypeError, "Failing invalid characters");
67
+
68
+ raises(function() {
69
+ u.subdomain("foo@example.org");
70
+ }, TypeError, "Failing invalid characters");
71
+ });
72
+ test("tld", function() {
73
+ var u = new URI("http://example.com/dir1/dir2/?query1=value1&query2=value2#hash");
74
+
75
+ raises(function() {
76
+ u.tld("foo/bar.html");
77
+ }, TypeError, "Failing invalid characters");
78
+ });
79
+ test("path", function() {
80
+ var u = new URI("http://example.com/dir1/dir2/?query1=value1&query2=value2#hash");
81
+ u.path("/dir3/?query3=value3#fragment");
82
+ equal(u.hostname(), "example.com", "path() has modified hostname");
83
+ equal(u.path(), "/dir3/%3Fquery3=value3%23fragment", "path() has set invalid path");
84
+ equal(u.query(), "query1=value1&query2=value2", "path() has modified query");
85
+ equal(u.fragment(), "hash", "path() has modified fragment");
86
+ });
87
+ test("filename", function() {
88
+ var u = new URI("http://example.com/dir1/dir2/?query1=value1&query2=value2#hash");
89
+
90
+ u.filename("name.html?query");
91
+ equal(u.filename(), "name.html%3Fquery", "filename() has set invalid filename");
92
+ equal(u.query(), "query1=value1&query2=value2", "filename() has modified query");
93
+
94
+ // allowed!
95
+ u.filename("../name.html?query");
96
+ equal(u.filename(), "name.html%3Fquery", "filename() has set invalid filename");
97
+ equal(u.directory(), "/dir1", "filename() has not altered directory properly");
98
+ });
99
+ test("addQuery", function() {
100
+ var u = new URI("http://example.com/dir1/dir2/?query1=value1&query2=value2#hash");
101
+ u.addQuery("query3", "value3#got");
102
+ equal(u.query(), "query1=value1&query2=value2&query3=value3%23got", "addQuery() has set invalid query");
103
+ equal(u.fragment(), "hash", "addQuery() has modified fragment");
104
+ });
105
+
106
+ /*
107
+ // RFC 3986 says "…and should limit these names to no more than 255 characters in length."
108
+ // SHOULD is not MUST therefore not the responsibility of URI.js
109
+
110
+ module("validation");
111
+ test("domain", function() {
112
+ // this bases on the wiki page information: http://en.wikipedia.org/wiki/Domain_Name_System
113
+ var u = new URI("http://example.com/"), domain, i, j;
114
+
115
+ //generate a 204 character domain
116
+ domain = "com"
117
+ for (i=0; i<20; i++) {
118
+ domain = "0123456789." + domain;
119
+ }
120
+ u.domain(domain);
121
+ equals(u.hostname(), domain, "domain() has not set 204-character-domain");
122
+
123
+ //expand the domain to a 404 character domain
124
+ for (i=0; i<20; i++) {
125
+ domain = "0123456789." + domain;
126
+ }
127
+ u.domain(domain);
128
+ equals(u.hostname() == domain, true, "set domain() with "+domain.length+" charachters - not valid domainname");
129
+
130
+ //generate a domain with three 70-char subdomains-parts.
131
+ domain = "com";
132
+ for (j=0; j<3; j++) {
133
+ //start new subdomain
134
+ domain = "." + domain;
135
+ for (i=0; i<70; i++) {
136
+ domain = "a" + domain;
137
+ }
138
+ }
139
+ u.domain(domain);
140
+ equals(u.hostname() == domain, true, "set domain() with 70-character subdomain not valid domainname");
141
+ });
142
+ */
143
+ })();
@@ -0,0 +1,138 @@
1
+ (function(){
2
+ module("jQuery.URI", {
3
+ setup: function() {
4
+ var links = [
5
+ '<a href="http://example.org/">an HTTP link</a>',
6
+ '<a href="https://example.org/">an HTTPS link</a>',
7
+ '<a href="http://example.org/so)me.pdf">some pdf</a>',
8
+ '<a href="http://example.org/hello/world.html">hello world</a>',
9
+ '<a href="ftp://localhost/one/two/three/file.ext">directories</a>',
10
+ '<a href="ftp://localhost/one/two/file.ext">directories</a>',
11
+ '<a href="mailto:mail@example.org?subject=Hello+World">Mail me</a>',
12
+ '<a href="javascript:alert(\'ugly!\');">some javascript</a>',
13
+ '<a href="#anchor">jump to anchor</a>',
14
+ '<img src="/dontexist.jpg" alt="some jpeg">',
15
+ '<img src="/dontexist.svg" alt="some svg">',
16
+ '<form method="post" action="/some/script.php"></form>'
17
+ ];
18
+
19
+ $('<div id="testestest">' + links.join('') + '</div>')
20
+ .appendTo(document.body);
21
+ $('<div>foo</div>')
22
+ .appendTo(document.body);
23
+
24
+ var script = document.createElement('script');
25
+ script.type = 'text/javascript';
26
+ script.src = '/nonexistant.js';
27
+ document.getElementById('testestest').appendChild(script);
28
+ },
29
+ teardown: function() {
30
+ var t = $('#testestest');
31
+ t.next().remove();
32
+ t.remove();
33
+ }
34
+ });
35
+ test(".uri()", function() {
36
+ var $links = $('#testestest'),
37
+ $first = $links.children().first(),
38
+ uri = $first.uri(),
39
+ _uri = URI('/hello.world');
40
+
41
+ ok(uri !== _uri, "different URI instances");
42
+ var __uri = $first.uri(_uri);
43
+ ok(uri !== _uri, "different URI instances");
44
+ ok(uri === __uri, "same URI instances");
45
+ equal($first.attr('href'), _uri.toString(), "equal URI");
46
+
47
+ });
48
+ test("filtering with :uri()", function() {
49
+ var $links = $('#testestest');
50
+
51
+ // find using accessor and "begins with" comparison
52
+ equal($('a:uri(href^=#anc)').length, 1, "$(selector) Anchor Link");
53
+ equal($links.find(':uri(href^=#anc)').length, 1, ".find(selector) Anchor Link");
54
+
55
+ // find using accessor and "ends with" comparison
56
+ equal($(':uri(href$=.css)').length, 1, ":uri(href$=.css)");
57
+
58
+ // find using accessor and "contains" comparison
59
+ equal($(':uri(href *= /hello/)').length, 1, ":uri(href *= /hello/)");
60
+
61
+ // find using accessor and "equals" comparison
62
+ equal($links.find(':uri(protocol=https)').length, 1, ":uri(protocol=https)");
63
+ equal($links.find(':uri(protocol=http)').length, 3, ":uri(protocol=http)");
64
+
65
+ // directory match with trailing slash
66
+ equal($links.find(':uri(directory *= /two/)').length, 2, ":uri(directory *= /two/)");
67
+
68
+ // find using URI.is()
69
+ equal($links.find(':uri(relative)').length, 5, ":uri(relative)");
70
+ equal($links.find(':uri(is:relative)').length, 5, ":uri(is:relative)");
71
+ equal($links.find(':uri(is: relative)').length, 5, ":uri(is:relative)");
72
+
73
+ // find using URI.equal()
74
+ // This syntax breaks Sizzle, probably because it's looking for a nested pseudo ":http"
75
+ //equal($links.find(':uri(equals:http://example.org/hello/foo/../world.html)').length, 1, ":uri(equals:$url$)");
76
+ equal($links.find(':uri(equals:"http://example.org/hello/foo/../world.html")').length, 1, ":uri(equals:$url$)");
77
+ equal($links.find(':uri(equals: "http://example.org/hello/foo/../world.html")').length, 1, ":uri(equals:$url$)");
78
+
79
+ // find URNs
80
+ equal($links.find(':uri(urn)').length, 2, ":uri(urn)");
81
+
82
+ // .is()
83
+ equal($links.children('script').is(':uri(suffix=js)'), true, ".is(':uri(suffix=js)')");
84
+ equal($links.children('form').is(':uri(suffix=php)'), true, ".is(':uri(suffix=php)')");
85
+
86
+ // .has()
87
+ equal($('div').has(':uri(suffix=js)').length, 1, ".has(':uri(suffix=js)')");
88
+ });
89
+ test(".attr('href')", function() {
90
+ var $links = $('#testestest'),
91
+ $first = $links.children().first(),
92
+ first = $first.get(0),
93
+ uri = $first.uri(),
94
+ href = function(elem) {
95
+ return elem.getAttribute('href');
96
+ };
97
+
98
+ if (!$.support.hrefNormalized) {
99
+ href = function(elem) {
100
+ return elem.getAttribute('href', 2);
101
+ };
102
+ }
103
+
104
+ ok(uri instanceof URI, "instanceof URI");
105
+ equal(href(first), uri.toString(), "URI equals href");
106
+
107
+ // test feedback to DOM element
108
+ uri.hostname('example.com');
109
+ ok($first.uri() === uri, "URI persisted");
110
+ equal(href(first), uri.toString(), "transparent href update");
111
+
112
+ // test feedback from DOM element
113
+ $first.attr('href', 'http://example.net/');
114
+ ok($first.uri() === uri, "URI persisted");
115
+ equal(href(first), uri.toString(), "transparent href update");
116
+ });
117
+ test(".attr('uri:accessor')", function() {
118
+ var $links = $('#testestest'),
119
+ $first = $links.children().first(),
120
+ uri = $first.uri(),
121
+ href = function(elem) {
122
+ return elem.getAttribute('href');
123
+ };
124
+
125
+ if (!$.support.hrefNormalized) {
126
+ href = function(elem) {
127
+ return elem.getAttribute('href', 2);
128
+ };
129
+ }
130
+
131
+ equal($first.attr('uri:hostname'), 'example.org', 'reading uri:hostname');
132
+ $first.attr('uri:hostname', 'example.com');
133
+ equal($first.attr('uri:hostname'), 'example.com', 'changed uri:hostname');
134
+ equal($first.is(':uri(hostname=example.com)'), true, ':uri() after changed uri:hostname');
135
+ ok($first.uri() === uri, "URI persisted");
136
+ });
137
+
138
+ })();