Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

woohoo

  • Loading branch information...
commit 2cdbdc4484d6f93eaa3caf23236a341453a0dde2 1 parent 7e221e4
@rodneyrehm rodneyrehm authored
View
64 test/gexpect.js
@@ -0,0 +1,64 @@
+(function(root) {
+
+var hasOwn = Object.prototype.hasOwnProperty.call;
+var initial = collect();
+var expected = {
+ gexpect: true
+};
+
+function isArray(obj) {
+ return String(Object.prototype.toString.call(obj)) === "[object Array]";
+}
+
+function collect() {
+ var globals = {};
+
+ for (var key in root) {
+ try {
+ globals[key] = true;
+ } catch(ex) {}
+ }
+
+ return globals;
+}
+
+window.gexpect = {
+ jQuery: ['$', 'jQuery'],
+ QUnit: ["urlParams", "isLocal", "module", "asyncTest", "test", "expect", "start", "stop", "assert", "ok", "equal", "notEqual", "deepEqual", "notDeepEqual", "strictEqual", "notStrictEqual", "throws", "raises", "equals", "same", "QUnit"],
+ add: function(key) {
+ if (arguments.length > 1) {
+ this.add.call(this, Array.prototype.slice.call(arguments, 0));
+ } else if (isArray(key)) {
+ for (var i = 0, l = key.length; i < l; i++) {
+ expected[key[i]] = true;
+ }
+ } else if (typeof key === "string") {
+ expected[key] = true;
+ } else {
+ throw new Error('gexpect.add() expects string or array of strings!');
+ }
+
+ return this;
+ },
+ find: function() {
+ var globals = collect();
+ var unexpected = [];
+ for (var key in globals) {
+ if (initial[key] || expected[key]) {
+ continue;
+ }
+
+ unexpected.push(key);
+ }
+
+ return unexpected;
+ },
+ verify: function(name) {
+ var unexpected = this.find();
+ if (unexpected.length) {
+ console.warn('Unexpected global variables after ' + name + ': ' + unexpected.join(', '));
+ }
+ }
+};
+
+})(this);
View
3  test/index.html
@@ -12,11 +12,12 @@
<script type="text/javascript" src="../jquery-1.8.2.min.js"></script>
<script type="text/javascript" src="../src/jquery.URI.js"></script>
<script type="text/javascript" src="qunit/qunit.js"></script>
-
+<!--
<script type="text/javascript" src="urls.js"></script>
<script type="text/javascript" src="test.js"></script>
<script type="text/javascript" src="test_jim.js"></script>
<script type="text/javascript" src="test_template.js"></script>
+-->
<script type="text/javascript" src="test_jquery.js"></script>
</head>
<body>
View
6 test/qunit/qunit.js
@@ -453,6 +453,10 @@ QUnit.assert = {
* @example equal( format( "Received {0} bytes.", 2), "Received 2 bytes.", "format() replaces {0} with next argument" );
*/
equal: function( actual, expected, message ) {
+ var rrehm = config;
+ console.log("equal:" + (config === window._ficken ? "yep" : "nope"));
+ console.log("current: " + String(QUnit.config.current));
+
QUnit.push( expected == actual, actual, expected, message );
},
@@ -611,6 +615,8 @@ config = {
// Set of all modules.
modules: {},
+
+ current: null,
// logging callback queues
begin: [],
View
105 test/test_jquery.js
@@ -31,106 +31,23 @@ module("jQuery.URI", {
t.remove();
}
});
-test(".uri()", function() {
- var $links = $('#testestest'),
- $first = $links.children().first(),
- uri = $first.uri(),
- _uri = URI('/hello.world');
-
- ok(uri !== _uri, "different URI instances");
- var __uri = $first.uri(_uri);
- ok(uri !== _uri, "different URI instances");
- ok(uri === __uri, "same URI instances");
- equal($first.attr('href'), _uri.toString(), "equal URI");
-
-});
+
test("filtering with :uri()", function() {
var $links = $('#testestest');
-
- // find using accessor and "begins with" comparison
- equal($('a:uri(href^=#anc)').length, 1, "$(selector) Anchor Link");
- equal($links.find(':uri(href^=#anc)').length, 1, ".find(selector) Anchor Link");
- // find using accessor and "ends with" comparison
- equal($(':uri(href$=.css)').length, 1, ":uri(href$=.css)");
-
- // find using accessor and "contains" comparison
- equal($(':uri(href *= /hello/)').length, 1, ":uri(href *= /hello/)");
-
- // find using accessor and "equals" comparison
- equal($links.find(':uri(protocol=https)').length, 1, ":uri(protocol=https)");
- equal($links.find(':uri(protocol=http)').length, 3, ":uri(protocol=http)");
-
- // directory match with trailing slash
- equal($links.find(':uri(directory *= /two/)').length, 2, ":uri(directory *= /two/)");
-
- // find using URI.is()
- equal($links.find(':uri(relative)').length, 5, ":uri(relative)");
- equal($links.find(':uri(is:relative)').length, 5, ":uri(is:relative)");
- equal($links.find(':uri(is: relative)').length, 5, ":uri(is:relative)");
-
- // find using URI.equal()
- // This syntax breaks Sizzle, probably because it's looking for a nested pseudo ":http"
- //equal($links.find(':uri(equals:http://example.org/hello/foo/../world.html)').length, 1, ":uri(equals:$url$)");
- equal($links.find(':uri(equals:"http://example.org/hello/foo/../world.html")').length, 1, ":uri(equals:$url$)");
- equal($links.find(':uri(equals: "http://example.org/hello/foo/../world.html")').length, 1, ":uri(equals:$url$)");
-
- // find URNs
- equal($links.find(':uri(urn)').length, 2, ":uri(urn)");
-
- // .is()
- equal($links.children('script').is(':uri(suffix=js)'), true, ".is(':uri(suffix=js)')");
- equal($links.children('form').is(':uri(suffix=php)'), true, ".is(':uri(suffix=php)')");
-
- // .has()
- equal($('div').has(':uri(suffix=js)').length, 1, ".has(':uri(suffix=js)')");
-});
-test(".attr('href')", function() {
- var $links = $('#testestest'),
- $first = $links.children().first(),
- first = $first.get(0),
- uri = $first.uri(),
- href = function(elem) {
- return elem.getAttribute('href');
- };
-
- if (!$.support.hrefNormalized) {
- href = function(elem) {
- return elem.getAttribute('href', 2);
- };
- }
+ console.log(String(QUnit.config.current));
+ window._ficken = QUnit.config;
+ equal($('a:uri(href^=#anc)').length, 1, "$(selector) Anchor Link");
- ok(uri instanceof URI, "instanceof URI");
- equal(href(first), uri.toString(), "URI equals href");
+ console.log(String(QUnit.config.current));
+ window._ficken = QUnit.config;
+ equal($links.find(':uri(href^=#anc)').length, 1, ".find(selector) Anchor Link");
- // test feedback to DOM element
- uri.hostname('example.com');
- ok($first.uri() === uri, "URI persisted");
- equal(href(first), uri.toString(), "transparent href update");
+ console.log(String(QUnit.config.current));
+ window._ficken = QUnit.config;
+ equal($(':uri(href$=.css)').length, 1, ":uri(href$=.css)");
- // test feedback from DOM element
- $first.attr('href', 'http://example.net/');
- ok($first.uri() === uri, "URI persisted");
- equal(href(first), uri.toString(), "transparent href update");
-});
-test(".attr('uri:accessor')", function() {
- var $links = $('#testestest'),
- $first = $links.children().first(),
- uri = $first.uri(),
- href = function(elem) {
- return elem.getAttribute('href');
- };
-
- if (!$.support.hrefNormalized) {
- href = function(elem) {
- return elem.getAttribute('href', 2);
- };
- }
+ console.log("-------");
- equal($first.attr('uri:hostname'), 'example.org', 'reading uri:hostname');
- $first.attr('uri:hostname', 'example.com');
- equal($first.attr('uri:hostname'), 'example.com', 'changed uri:hostname');
- equal($first.is(':uri(hostname=example.com)'), true, ':uri() after changed uri:hostname');
- ok($first.uri() === uri, "URI persisted");
});
View
66 test/wat.html
@@ -0,0 +1,66 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <meta charset="UTF-8" />
+ <title>URI Test Suite</title>
+ <link rel="stylesheet" href="qunit/qunit.css" type="text/css" media="screen">
+ <script type="text/javascript" src="qunit/qunit.js"></script>
+
+ <script>
+
+ module("wat wat", {
+ setup: function() {
+
+ },
+ teardown: function() {
+
+ }
+ });
+
+ test("one", function() {
+ window._ficken = QUnit.config;
+ console.log(String(QUnit.config.current));
+ ok(true, "1");
+
+ window._ficken = QUnit.config;
+ console.log(String(QUnit.config.current));
+ ok(true, "2");
+
+ window._ficken = QUnit.config;
+ console.log(String(QUnit.config.current));
+ ok(true, "3");
+ });
+
+ test("one", function() {
+ window._ficken = QUnit.config;
+ console.log(String(QUnit.config.current));
+ equal(true, true, "1");
+
+ window._ficken = QUnit.config;
+ console.log(String(QUnit.config.current));
+ equal(true, true, "2");
+
+ window._ficken = QUnit.config;
+ console.log(String(QUnit.config.current));
+ equal(true, true, "3");
+
+ window._ficken = QUnit.config;
+ console.log(String(QUnit.config.current));
+ equal(true, true, "4");
+
+ window._ficken = QUnit.config;
+ console.log(String(QUnit.config.current));
+ equal(true, true, "5");
+ });
+
+ </script>
+</head>
+<body>
+ <h1 id="qunit-header">QUnit Test Suite</h1>
+ <h2 id="qunit-banner"></h2>
+ <div id="qunit-testrunner-toolbar"></div>
+ <h2 id="qunit-userAgent"></h2>
+ <ol id="qunit-tests"></ol>
+ <div id="qunit-fixture">test markup</div>
+</body>
+</html>

0 comments on commit 2cdbdc4

Please sign in to comment.
Something went wrong with that request. Please try again.