Skip to content

Commit

Permalink
adding a test for stylesheets
Browse files Browse the repository at this point in the history
  • Loading branch information
erikvold committed Aug 18, 2012
1 parent b935c78 commit cec6f1e
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 42 deletions.
13 changes: 2 additions & 11 deletions lib/main.js
@@ -1,5 +1,5 @@
exports.main = function(options) {
const {AboutHandler, ProtocolHandler} = require('protocol'),

const protocol = require('protocol'),
ao = require("achievement-overlay"),
BrandStringBundle = require("app-strings").StringBundle("chrome://branding/locale/brand.properties"),
{Cc,Ci,Cu} = require("chrome"),
Expand All @@ -17,14 +17,6 @@ exports.main = function(options) {
_ = require("l10n").get;

const brandShortName = BrandStringBundle.get("brandShortName");
let protocol = {
about: function(about, handler) {
return AboutHandler.extend(handler, { scheme: about }).new()
},
protocol: function(scheme, handler) {
return ProtocolHandler.extend(handler, { scheme: scheme }).new()
}
}
const aboutCheevosUrl = "about:cheevos";

let objHolder = {};
Expand Down Expand Up @@ -1009,4 +1001,3 @@ exports.main = function(options) {
}
});
aboutCheevosHandler.register();
};
45 changes: 14 additions & 31 deletions test/test-main.js
@@ -1,32 +1,15 @@
const main = require("main");

exports.test_test_run = function(test) {
test.pass("Unit test running!");
};

exports.test_id = function(test) {
test.assert(require("self").id.length > 0);
};

exports.test_url = function(test) {
require("request").Request({
url: "http://www.mozilla.org/",
onComplete: function(response) {
test.assertEqual(response.statusText, "OK");
test.done();
}
}).get();
test.waitUntilDone(20000);
};

exports.test_open_tab = function(test) {
const tabs = require("tabs");
tabs.open({
url: "http://www.mozilla.org/",
onReady: function(tab) {
test.assertEqual(tab.url, "http://www.mozilla.org/");
test.done();
}
});
test.waitUntilDone(20000);
'use strict';

const { Loader } = require('test-harness/loader');
const { data } = require('self');

exports.testStylesheetIsRegistered = function(test) {
let loader = Loader(module);
loader.require('main');
test.assertEqual(
require('userstyles').registered(data.url("chrome.css"), {type: 'agent'}),
true,
'The cheeevos style sheet was registered'
);
loader.unload();
};

0 comments on commit cec6f1e

Please sign in to comment.