From 535d1eefe2e2d78c84c414e6fb8618282adfc7b8 Mon Sep 17 00:00:00 2001 From: ippa Date: Tue, 19 Aug 2014 21:42:40 +0200 Subject: [PATCH] tests for jaws.assets.load() --- test/assets.js | 27 ++++++++++++++++++++------- 1 file changed, 20 insertions(+), 7 deletions(-) diff --git a/test/assets.js b/test/assets.js index fa34817..e4d21c6 100644 --- a/test/assets.js +++ b/test/assets.js @@ -78,16 +78,29 @@ test("audio wildcard assets", function() { }); -/* -test("assets.load()", function() { - stop() +asyncTest("assets.load()", function(assert) { + expect(1); + var assets = new jaws.Assets() + assets.root = "assets/" + var load = function(event) { + assert.ok( assets.get("rect.png"), "load-callback loaded image"); + QUnit.start(); + } + // var error = function() { assert.ok(false, "error callback doesn't get called"); } + assets.load("rect.png", {onload: load}); +}); + +asyncTest("assets.load() error", function(assert) { + expect(1); var assets = new jaws.Assets() assets.root = "assets/" - var load = function() { ok(jaws.assets.get("rect.png"), "load-callback loaded image"); start() } - var error = function() { ok(false, "error callback doesn't get called"); start() } - assets.load("rect.png", {onload: load, onerror: error}); + var error = function(event) { + assert.ok(true, "error callback should be caled"); + QUnit.start(); + } + assets.load("rect_404.png", {onerror: error}); }); -*/ + test("image asset with 404s", function() { stop()