Initial work to get working in Firefox

This commit is contained in:
Nathaniel van Diepen
2016-12-14 13:55:43 -07:00
parent 628d6eb2f1
commit 9823acc03f
81 changed files with 5501 additions and 5496 deletions

View File

@@ -1,11 +1,11 @@
var chai = require('chai');
var sinon = require('sinon');
var chrome = require('sinon-chrome');
var expect = chai.expect;
describe('Chrome Dev Tools', function() {
it('should work', function() {
chrome.browserAction.setTitle({title: 'hello'});
sinon.assert.calledOnce(chrome.browserAction.setTitle);
});
});
var chai = require('chai');
var sinon = require('sinon');
var chrome = require('sinon-chrome');
var expect = chai.expect;
describe('Chrome Dev Tools', function() {
it('should work', function() {
chrome.browserAction.setTitle({title: 'hello'});
sinon.assert.calledOnce(chrome.browserAction.setTitle);
});
});

View File

@@ -1,10 +1,10 @@
var chai = require('chai');
var expect = chai.expect;
import changeExtensionIcon from '../../assets/js/helpers/changeExtensionIcon';
describe('changeExtensionIcon', function() {
it('should be a function', function() {
expect(changeExtensionIcon).to.be.a('function');
});
var chai = require('chai');
var expect = chai.expect;
import changeExtensionIcon from '../../assets/js/helpers/changeExtensionIcon';
describe('changeExtensionIcon', function() {
it('should be a function', function() {
expect(changeExtensionIcon).to.be.a('function');
});
});

View File

@@ -1,10 +1,10 @@
var chai = require('chai');
var expect = chai.expect;
import changeExtensionState from '../../assets/js/helpers/changeExtensionState';
describe('changeExtensionState', function() {
it('should be a function', function() {
expect(changeExtensionState).to.be.a('function');
});
var chai = require('chai');
var expect = chai.expect;
import changeExtensionState from '../../assets/js/helpers/changeExtensionState';
describe('changeExtensionState', function() {
it('should be a function', function() {
expect(changeExtensionState).to.be.a('function');
});
});

View File

@@ -1,18 +1,18 @@
var chai = require('chai');
var sinon = require('sinon-chai');
var chrome = require('sinon-chrome');
var expect = chai.expect;
import changeExtensionTooltip from '../../assets/js/helpers/changeExtensionTooltip';
describe('changeExtensionTooltip', function() {
it('should be a function', function() {
expect(changeExtensionTooltip).to.be.a('function');
});
// it('should change the extension tooltip', function() {
// changeExtensionTooltip('WakaTime');
// expect(chrome.browserAction.setTitle).toHaveBeenCalledWith({title: 'Wakatime'});
// sinon.assert.calledWithMatch(chrome.browserAction.setTitle, {title: 'WakaTime'});
// });
});
var chai = require('chai');
var sinon = require('sinon-chai');
var chrome = require('sinon-chrome');
var expect = chai.expect;
import changeExtensionTooltip from '../../assets/js/helpers/changeExtensionTooltip';
describe('changeExtensionTooltip', function() {
it('should be a function', function() {
expect(changeExtensionTooltip).to.be.a('function');
});
// it('should change the extension tooltip', function() {
// changeExtensionTooltip('WakaTime');
// expect(chrome.browserAction.setTitle).toHaveBeenCalledWith({title: 'Wakatime'});
// sinon.assert.calledWithMatch(chrome.browserAction.setTitle, {title: 'WakaTime'});
// });
});

View File

@@ -1,26 +1,26 @@
var chai = require('chai');
var expect = chai.expect;
import contains from '../../assets/js/helpers/contains';
describe('contains', function() {
it('should be a function', function() {
expect(contains).to.be.a('function');
});
it('should match url against blacklist and return true', function() {
var list = "localhost\ntest.com";
var url = 'http://localhost/fooapp';
expect(contains(url, list)).to.equal(true);
});
it('should not match url against blacklist and return false', function() {
var list = "localhost2\ntest.com";
var url = 'http://localhost/fooapp';
expect(contains(url, list)).to.equal(false);
});
});
var chai = require('chai');
var expect = chai.expect;
import contains from '../../assets/js/helpers/contains';
describe('contains', function() {
it('should be a function', function() {
expect(contains).to.be.a('function');
});
it('should match url against blacklist and return true', function() {
var list = "localhost\ntest.com";
var url = 'http://localhost/fooapp';
expect(contains(url, list)).to.equal(true);
});
it('should not match url against blacklist and return false', function() {
var list = "localhost2\ntest.com";
var url = 'http://localhost/fooapp';
expect(contains(url, list)).to.equal(false);
});
});

View File

@@ -1,19 +1,19 @@
var chai = require('chai');
var expect = chai.expect;
import getDomainFromUrl from '../../assets/js/helpers/getDomainFromUrl';
describe('getDomainFromUrl', function() {
it('should be a function', function() {
expect(getDomainFromUrl).to.be.a('function');
});
it('should return the domain', function() {
expect(getDomainFromUrl('http://google.com/something/very/secret')).to.equal('http://google.com');
expect(getDomainFromUrl('http://www.google.com/something/very/secret')).to.equal('http://www.google.com');
// This is not how it was imaged to work, but let's leave it here as a warning.
expect(getDomainFromUrl('google.com/something/very/secret')).to.equal('google.com//very');
});
var chai = require('chai');
var expect = chai.expect;
import getDomainFromUrl from '../../assets/js/helpers/getDomainFromUrl';
describe('getDomainFromUrl', function() {
it('should be a function', function() {
expect(getDomainFromUrl).to.be.a('function');
});
it('should return the domain', function() {
expect(getDomainFromUrl('http://google.com/something/very/secret')).to.equal('http://google.com');
expect(getDomainFromUrl('http://www.google.com/something/very/secret')).to.equal('http://www.google.com');
// This is not how it was imaged to work, but let's leave it here as a warning.
expect(getDomainFromUrl('google.com/something/very/secret')).to.equal('google.com//very');
});
});

View File

@@ -1,18 +1,18 @@
var chai = require('chai');
var expect = chai.expect;
import in_array from '../../assets/js/helpers/in_array';
describe('in_array', function() {
it('should be a function', function() {
expect(in_array).to.be.a('function');
});
it('should find the needle and return true', function() {
expect(in_array('4', ['4', '3', '2', '1'])).to.equal(true);
});
it('should not find the needle and it should return false', function() {
expect(in_array('5', ['4', '3', '2', '1'])).to.equal(false);
});
var chai = require('chai');
var expect = chai.expect;
import in_array from '../../assets/js/helpers/in_array';
describe('in_array', function() {
it('should be a function', function() {
expect(in_array).to.be.a('function');
});
it('should find the needle and return true', function() {
expect(in_array('4', ['4', '3', '2', '1'])).to.equal(true);
});
it('should not find the needle and it should return false', function() {
expect(in_array('5', ['4', '3', '2', '1'])).to.equal(false);
});
});