1
Fork 0

Initialise with basic testing files

This commit is contained in:
Jake Howard 2015-08-19 15:20:16 +01:00
commit 32070ea264
6 changed files with 70 additions and 0 deletions

2
firefox/README.md Normal file
View file

@ -0,0 +1,2 @@
#injection testing
A basic add-on

4
firefox/data/jquery.js vendored Normal file

File diff suppressed because one or more lines are too long

17
firefox/data/script.js Normal file
View file

@ -0,0 +1,17 @@
$('.fbNubFlyout').on('DOMNodeInserted DOMNodeRemoved change load', function(event) {
$('._d97').each(function(){
$(this).html($(this).html().replace('expected',
"<img class='emoticon' style='height: 30px; width: 30px;' src='http://icons.iconarchive.com/icons/hopstarter/sleek-xp-software/256/Yahoo-Messenger-icon.png'/>"
));
console.log("Change made!");
});
});
window.setInterval(function(){ //Force it every now and then
elements = $('.fbNubFlyout');
if (elements.length != 0) {
elements.trigger('change');
}
}, 5000);

15
firefox/index.js Normal file
View file

@ -0,0 +1,15 @@
var self = require('sdk/self');
var pageMod = require("sdk/page-mod");
// a dummy function, to show how tests work.
// to see how to test this function, look at test/test-index.js
function dummy(text, callback) {
callback(text);
}
pageMod.PageMod({
include: "*.facebook.com",
contentScriptFile: ["./jquery.js", "./script.js"]
});
exports.dummy = dummy;

13
firefox/package.json Normal file
View file

@ -0,0 +1,13 @@
{
"title": "injection testing",
"name": "injectiontesting",
"version": "0.0.1",
"description": "A basic add-on",
"main": "index.js",
"author": "Jake Howard",
"engines": {
"firefox": ">=38.0a1",
"fennec": ">=38.0a1"
},
"license": "MIT"
}

View file

@ -0,0 +1,19 @@
var main = require("../");
exports["test main"] = function(assert) {
assert.pass("Unit test running!");
};
exports["test main async"] = function(assert, done) {
assert.pass("async Unit test running!");
done();
};
exports["test dummy"] = function(assert, done) {
main.dummy("foo", function(text) {
assert.ok((text === "foo"), "Is the text actually 'foo'");
done();
});
};
require("sdk/test").run(exports);