Initialise with basic testing files
This commit is contained in:
commit
32070ea264
6 changed files with 70 additions and 0 deletions
2
firefox/README.md
Normal file
2
firefox/README.md
Normal file
|
@ -0,0 +1,2 @@
|
|||
#injection testing
|
||||
A basic add-on
|
4
firefox/data/jquery.js
vendored
Normal file
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
17
firefox/data/script.js
Normal 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
15
firefox/index.js
Normal 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
13
firefox/package.json
Normal 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"
|
||||
}
|
19
firefox/test/test-index.js
Normal file
19
firefox/test/test-index.js
Normal 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);
|
Reference in a new issue