Permalink
Browse files

Update to latest QUnit and run also with PhantomJS

  • Loading branch information...
1 parent 4ebebdb commit 9da2d3b15c792315b97e6ae16651e89ac6f215e7 @bergie committed Sep 24, 2012
View
@@ -8,6 +8,7 @@ before_script:
script:
- ./node_modules/.bin/jshint src/
- npm test
+ - phantomjs test/qunit/run.js test/index.html
notifications:
irc: "irc.freenode.org#iks"
View
@@ -229,10 +229,10 @@ test("VIE - Type Sorting", function () {
ok(test(sortedArrayDesc2));
ok(v.types.sort([]));
- equals(v.types.sort([]).length, [].length);
+ equal(v.types.sort([]).length, [].length);
- equals(v.types.sort(["TestType1"]).length, 1);
- equals(v.types.sort(["TestType1"])[0], "TestType1");
+ equal(v.types.sort(["TestType1"]).length, 1);
+ equal(v.types.sort(["TestType1"])[0], "TestType1");
});
View
@@ -161,7 +161,7 @@ test("vie.js Entity API - setOrAdd", function () {
});
var clapton = z.entities.get('http://example.org/EricClapton');
clapton.setOrAdd('plays', 'guitar');
- equals(typeof z.entities.get('http://example.org/EricClapton').get('plays'), "string", "Single values are stored as they are");
+ equal(typeof z.entities.get('http://example.org/EricClapton').get('plays'), "string", "Single values are stored as they are");
clapton.setOrAdd('plays', 'vocals');
ok(z.entities.get('http://example.org/EricClapton').get('plays') instanceof Array, "Multiple values are stored as Arrays");
@@ -170,14 +170,14 @@ test("vie.js Entity API - setOrAdd", function () {
ok(!clapton.get('plays'), "Property unset");
clapton.setOrAdd({'plays': 'guitar'});
- equals(typeof clapton.get('plays'), "string", "Single values are stored as they are");
+ equal(typeof clapton.get('plays'), "string", "Single values are stored as they are");
clapton.setOrAdd({'plays': 'vocals'});
ok(clapton.get('plays') instanceof Array, "Multiple values are stored as Arrays");
- equals(clapton.get('plays').length, 2);
+ equal(clapton.get('plays').length, 2);
clapton.setOrAdd({'plays': 'vocals'});
- equals(clapton.get('plays').length, 3, "Same value twice is the same value and needs to be added twice.");
+ equal(clapton.get('plays').length, 3, "Same value twice is the same value and needs to be added twice.");
});
test("vie.js Entities API - set()", function () {
@@ -195,27 +195,27 @@ test("vie.js Entities API - set()", function () {
/* literals */
madonna.set({"name" : "Madonna"}); // set literal with object notation
- equals(madonna.get("name"), "Madonna");
+ equal(madonna.get("name"), "Madonna");
madonna.unset("name");
- equals(madonna.get("name"), undefined);
+ equal(madonna.get("name"), undefined);
madonna.set("name", "Madonna Louise Ciccone"); // set literal with simple notation
- equals(madonna.get("name"), "Madonna Louise Ciccone");
+ equal(madonna.get("name"), "Madonna Louise Ciccone");
madonna.unset("name");
madonna.set("name", ["Madonna", "Madonna Louise Ciccone"]); // set mulitple literals at the same time
- equals(madonna.get("name").length, 2);
+ equal(madonna.get("name").length, 2);
madonna.unset("name");
madonna.set("name", "Madonna");
madonna.set("name", "Madonna Louise Ciccone"); // overwrite existing literal
- equals(madonna.get("name"), "Madonna Louise Ciccone");
+ equal(madonna.get("name"), "Madonna Louise Ciccone");
madonna.unset("name");
madonna.set("name", "Madonna");
madonna.set("name", ["Madonna", "Madonna Louise Ciccone"]); // overwrite existing literal
- equals(madonna.get("name").length, 2);
+ equal(madonna.get("name").length, 2);
madonna.unset("name");
var britney = z.entities.addOrUpdate({
@@ -225,8 +225,8 @@ test("vie.js Entities API - set()", function () {
madonna.set("knows", britney); // set an entity
ok(madonna.get("knows").isCollection);
- equals(madonna.get("knows").size(), 1);
- equals(madonna.get("knows").at(0).getSubject(), britney.getSubject());
+ equal(madonna.get("knows").size(), 1);
+ equal(madonna.get("knows").at(0).getSubject(), britney.getSubject());
var courtney = z.entities.addOrUpdate({
@@ -236,18 +236,18 @@ test("vie.js Entities API - set()", function () {
madonna.set("knows", courtney); // set another entity
ok(madonna.get("knows").isCollection);
- equals(madonna.get("knows").size(), 1);
- equals(madonna.get("knows").at(0).getSubject(), courtney.getSubject());
+ equal(madonna.get("knows").size(), 1);
+ equal(madonna.get("knows").at(0).getSubject(), courtney.getSubject());
// Set with array of subject URIs, should still be a collection
var originalCollection = madonna.get("knows");
madonna.set({
knows: [courtney.getSubject()]
});
ok(madonna.get("knows").isCollection);
- equals(madonna.get("knows").size(), 1);
- equals(madonna.get("knows").at(0).getSubject(), courtney.getSubject());
- equals(madonna.get("knows"), originalCollection);
+ equal(madonna.get("knows").size(), 1);
+ equal(madonna.get("knows").at(0).getSubject(), courtney.getSubject());
+ equal(madonna.get("knows"), originalCollection);
});
test("vie.js Entities API - setOrUpdate with entities", function () {
@@ -277,9 +277,9 @@ test("vie.js Entities API - setOrUpdate with entities", function () {
var friends = madonna.get("knows");
- equals(madonna.get("knows").size(), 2);
- equals(madonna.get("knows").at(0).getSubject(), britney.getSubject());
- equals(madonna.get("knows").at(1).getSubject(), courtney.getSubject());
+ equal(madonna.get("knows").size(), 2);
+ equal(madonna.get("knows").at(0).getSubject(), britney.getSubject());
+ equal(madonna.get("knows").at(1).getSubject(), courtney.getSubject());
ok(friends);
});
@@ -297,11 +297,11 @@ test("vie.js Entity API - addTo", function () {
var sizeBefore = z.entities.size();
clapton.addTo(z.entities);
var sizeAfter = z.entities.size();
- equals(sizeAfter, sizeBefore + 1);
+ equal(sizeAfter, sizeBefore + 1);
z.entities.remove(clapton);
clapton.addTo(z.entities, true);
sizeAfter = z.entities.size();
- equals(sizeAfter, sizeBefore + 1);
+ equal(sizeAfter, sizeBefore + 1);
});
VIE.prototype.MockService = function () {
View
@@ -2,13 +2,15 @@
<html
version="XHTML+RDFa 1.0"
xml:lang="en"
- xmlns="http://www.w3.org/1999/xhtml">
+ xmlns="http://www.w3.org/1999/xhtml"
+ lang="en">
<head>
+ <meta charset="utf-8" />
<title>VIE browser tests</title>
<script type="text/javascript" src="../lib/jquery/1.7/jquery-1.7.1.min.js"></script>
- <link rel="stylesheet" href="qunit.css" type="text/css" media="screen" />
- <script type="text/javascript" src="qunit.js"></script>
+ <link rel="stylesheet" href="./qunit/qunit.css" type="text/css" media="screen" />
+ <script type="text/javascript" src="./qunit/qunit.js"></script>
<script type="text/javascript">
QUnit.config.testTimeout = 30000; // 30 seconds
QUnit.config.updateRate = 0;
View
@@ -18,7 +18,7 @@ exports['test inheriting subject'] = function(test) {
test.equal(jsonldEntities.length, 2, "This RDFa defines two entities but they don't get parsed to JSON");
test.equal(jsonldEntities[1]['<http://xmlns.com/foaf/0.1/name>'], 'Albert Einstein');
test.equal(jsonldEntities[0]['<http://dbpedia.org/resource/conventionalLongName>'], 'Federal Republic of Germany');
- test.equals(jsonldEntities[1]['<http://dbpedia.org/resource/birthPlace>'], jsonldEntities[0]['@subject'], "Check that the relation between the person and the birthplace was read correctly");
+ test.equal(jsonldEntities[1]['<http://dbpedia.org/resource/birthPlace>'], jsonldEntities[0]['@subject'], "Check that the relation between the person and the birthplace was read correctly");
var backboneEntities = VIE.RDFaEntities.getInstances(html);
test.equal(backboneEntities.length, 2, "This RDFa defines two entities but they don't get to Backbone");
Oops, something went wrong.

0 comments on commit 9da2d3b

Please sign in to comment.