Skip to content

Commit

Permalink
v1.1.0 (#38)
Browse files Browse the repository at this point in the history
* Add testing to most files
* Add node-pre-gyp for canvas-prebuilt
* Run tests in travis
* Fixes minor issues found by unit tests
  • Loading branch information
Ben Pevsner committed Sep 13, 2018
1 parent cecd1ea commit 21cebd3
Show file tree
Hide file tree
Showing 22 changed files with 1,574 additions and 753 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ sudo: false
node_js:
- "stable"

script: npm run build
script: npm run build && npm run test
78 changes: 78 additions & 0 deletions jestsetup.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
import "canvas-prebuilt"

global.chrome = {
runtime: {
lastError: null,
onMessage: {
addListener: jest.fn(),
},
sendMessage: jest.fn(),
},

storage: {
sync: {
get: jest.fn((value, callback) => {
if (typeof callback === "function") callback()
}),
set: jest.fn((value, callback) => {
if (typeof callback === "function") callback()
}),
}
},

tabs: {
get: jest.fn((tabId, callback) => {
if (typeof callback === "function") callback()
}),

getCurrent: jest.fn(callback => {
if (typeof callback === "function") callback();
}),

sendMessage: jest.fn(),

onUpdated: {
addListener: jest.fn(),
}
},
};

global.customElements = {
define: jest.fn(),
};

global.testContext = {
measureText: jest.fn(() => ({ width: 100 })),
clearRect: jest.fn(),
save: jest.fn(),
scale: jest.fn(),
fillText: jest.fn(),
beginPath: jest.fn(),
arc: jest.fn(),
fill: jest.fn(),
restore: jest.fn(),
};

// HTML Elements
[ "navlink", "navlink", "save", "save", "override-inputs" ]
.forEach((name, index) => {
const node = document.createElement("div");
node.className = name;
node.appendChild(document.createTextNode(name + index))
document.body.appendChild(node);
});

[ "page", "page" ]
.forEach((name, index) => {
const node = document.createElement("div");
node.className = "page navlink" + index;
document.body.appendChild(node);
});

[ "flag" ]
.forEach(name => {
const node = document.createElement("input");
node.type= "checkbox";
node.id = name;
document.body.appendChild(node);
});
2 changes: 1 addition & 1 deletion manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"manifest_version": 2,
"name": "Favioli",
"description": "Emoji favicons for the web",
"version": "1.0.0",
"version": "1.1.0",
"background": {
"scripts": [ "build/background.js" ]
},
Expand Down
Loading

0 comments on commit 21cebd3

Please sign in to comment.