var main require main var tabs require sdk tabs var timers require sdk

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
var main = require("./main");
var tabs = require("sdk/tabs");
var timers = require("sdk/timers");
function setHtml (html) {
html = html.replace(/'/g, "\\'");
tabs.activeTab.attach({
contentScript: "document.body.innerHTML = '" + html + "';"
});
}
exports["test rss page"] = function(assert, done) {
tabs.activeTab.url = "http://example.com/some/page";
tabs.activeTab.once("ready", function (tab) {
setHtml("<link rel='alternate' type='application/rss+xml' href='http://example.com/rss/recent/' />");
main.addContentScript(tab);
timers.setTimeout(function () {
main.addToFeedly();
timers.setTimeout(function () {
assert.equal(tabs.activeTab.url, "http://feedly.com/#subscription/feed/http://example.com/rss/recent/", "add-on opens Feedly tab on click");
//http://feedly.com/#subscription%2Ffeed%2Fhttp%3A%2F%2Fexample.com%2Frss%2Frecent%2F
done();
}, 300);
}, 300);
});
};
require("sdk/test").run(exports);