Compare commits

...

4 Commits

Author SHA1 Message Date
mickie 3685e8696b Fix css. 2021-08-18 22:03:21 -05:00
mickie 400da0ebbd Remove sinon 2021-08-18 20:17:05 -05:00
mickie 0104b27bbe Include tests 2021-08-18 20:16:30 -05:00
mickie aa0f0ee70d Rewrite makeButtons function. 2021-08-18 16:50:49 -05:00
9 changed files with 46 additions and 3120 deletions

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1,446 +0,0 @@
/*!
Fork Awesome 1.1.7
License - https://forkaweso.me/Fork-Awesome/license
Copyright 2018 Dave Gandy & Fork Awesome
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
.fas,
.fab,
.far {
display: inline-block;
font: normal normal normal 14px/1 ForkAwesome;
font-size: inherit;
text-rendering: auto;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
.fas.fa-chart-area:before {
content: "\f1fe";
}
.fas.fa-arrows-alt:before {
content: "\f047";
}
.fas.fa-expand-arrows-alt:before {
content: "\f0b2";
}
.fas.fa-arrows-alt-h:before {
content: "\f07e";
}
.fas.fa-arrows-alt-v:before {
content: "\f07d";
}
.fas.fa-calendar-alt:before {
content: "\f073";
}
.fas.fa-circle-notch:before {
content: "\f1ce";
}
.fas.fa-cloud-download-alt:before {
content: "\f0ed";
}
.fas.fa-cloud-upload-alt:before {
content: "\f0ee";
}
.fas.fa-credit-card:before {
content: "\f283";
}
.fas.fa-dollar-sign:before {
content: "\f155";
}
.fas.fa-euro-sign:before {
content: "\f153";
}
.fas.fa-exchange-alt:before {
content: "\f0ec";
}
.fas.fa-external-link-alt:before {
content: "\f08e";
}
.fas.fa-external-link-square-alt:before {
content: "\f14c";
}
.fas.fa-eye-dropper:before {
content: "\f1fb";
}
.fas.fa-pound-sign:before {
content: "\f154";
}
.fas.fa-glass-martini:before {
content: "\f000";
}
.fas.fa-shekel-sign:before {
content: "\f20b";
}
.fas.fa-rupee-sign:before {
content: "\f156";
}
.fas.fa-won-sign:before {
content: "\f159";
}
.fas.fa-level-down-alt:before {
content: "\f149";
}
.fas.fa-level-up-alt:before {
content: "\f148";
}
.fas.fa-chart-line:before {
content: "\f201";
}
.fas.fa-long-arrow-alt-down:before {
content: "\f175";
}
.fas.fa-long-arrow-alt-left:before {
content: "\f177";
}
.fas.fa-long-arrow-alt-right:before {
content: "\f178";
}
.fas.fa-long-arrow-alt-up:before {
content: "\f176";
}
.fas.fa-map-marker-alt:before {
content: "\f041";
}
.fas.fa-mobile-alt:before {
content: "\f10b";
}
.fas.fa-pencil-alt:before {
content: "\f040";
}
.fas.fa-pen-square:before {
content: "\f14b";
}
.fas.fa-chart-pie:before {
content: "\f200";
}
.fas.fa-yen-sign:before {
content: "\f157";
}
.fas.fa-ruble-sign:before {
content: "\f158";
}
.fas.fa-shield-alt:before {
content: "\f132";
}
.fas.fa-sign-in-alt:before {
content: "\f090";
}
.fas.fa-sign-out-alt:before {
content: "\f08b";
}
.fas.fa-sliders-h:before {
content: "\f1de";
}
.fas.fa-tablet-alt:before {
content: "\f10a";
}
.fas.fa-tachometer-alt:before {
content: "\f0e4";
}
.fas.fa-thumbtack:before {
content: "\f08d";
}
.fas.fa-ticket-alt:before {
content: "\f145";
}
.fas.fa-trash-alt:before {
content: "\f1f8";
}
.fas.fa-lira-sign:before {
content: "\f195";
}
.fab.fa-linkedin-in:before {
content: "\fe01";
}
.fab.fa-linkedin:before {
content: "\f08c";
}
.far.fa-address-book:before {
content: "\f2ba";
}
.far.fa-address-card:before {
content: "\f2bc";
}
.far.fa-arrow-alt-circle-down:before {
content: "\f01a";
}
.far.fa-arrow-alt-circle-left:before {
content: "\f190";
}
.far.fa-arrow-alt-circle-right:before {
content: "\f18e";
}
.far.fa-arrow-alt-circle-up:before {
content: "\f01b";
}
.far.fa-bell:before {
content: "\f0f3";
}
.far.fa-bell-slash:before {
content: "\f1f7";
}
.far.fa-bookmark:before {
content: "\f097";
}
.far.fa-building:before {
content: "\f0f7";
}
.far.fa-calendar-check:before {
content: "\f274";
}
.far.fa-calendar-minus:before {
content: "\f272";
}
.far.fa-calendar:before {
content: "\f133";
}
.far.fa-calendar-plus:before {
content: "\f271";
}
.far.fa-calendar-times:before {
content: "\f273";
}
.far.fa-caret-square-down:before {
content: "\f150";
}
.far.fa-caret-square-left:before {
content: "\f191";
}
.far.fa-caret-square-right:before {
content: "\f152";
}
.far.fa-caret-square-up:before {
content: "\f151";
}
.far.fa-check-circle:before {
content: "\f05d";
}
.far.fa-check-square:before {
content: "\f046";
}
.far.fa-circle:before {
content: "\f10c";
}
.far.fa-clock:before {
content: "\f017";
}
.far.fa-comment:before {
content: "\f0e5";
}
.far.fa-comment-dots:before {
content: "\f27b";
}
.far.fa-comments:before {
content: "\f0e6";
}
.far.fa-dot-circle:before {
content: "\f192";
}
.far.fa-id-card:before {
content: "\f2c3";
}
.far.fa-envelope:before {
content: "\f003";
}
.far.fa-envelope-open:before {
content: "\f2b7";
}
.far.fa-file-archive:before {
content: "\f1c6";
}
.far.fa-file-audio:before {
content: "\f1c7";
}
.far.fa-file-code:before {
content: "\f1c9";
}
.far.fa-file-excel:before {
content: "\f1c3";
}
.far.fa-file-image:before {
content: "\f1c5";
}
.far.fa-file-video:before {
content: "\f1c8";
}
.far.fa-copy:before,
.far.fa-file:before {
content: "\f016";
}
.far.fa-file-pdf:before {
content: "\f1c1";
}
.far.fa-file-powerpoint:before {
content: "\f1c4";
}
.far.fa-file-alt:before {
content: "\f0f6";
}
.far.fa-file-word:before {
content: "\f1c2";
}
.far.fa-flag:before {
content: "\f11d";
}
.far.fa-save:before {
content: "\f0c7";
}
.far.fa-folder:before {
content: "\f114";
}
.far.fa-folder-open:before {
content: "\f115";
}
.far.fa-frown:before {
content: "\f119";
}
.far.fa-futbol:before {
content: "\f1e3";
}
.far.fa-hand-rock:before {
content: "\f255";
}
.far.fa-hand-lizard:before {
content: "\f258";
}
.far.fa-hand-point-down:before {
content: "\f0a7";
}
.far.fa-hand-point-left:before {
content: "\f0a5";
}
.far.fa-hand-point-right:before {
content: "\f0a4";
}
.far.fa-hand-point-up:before {
content: "\f0a6";
}
.far.fa-hand-paper:before {
content: "\256";
}
.far.fa-hand-pointer:before {
content: "\f25a";
}
.far.fa-hand-scissors:before {
content: "\f257";
}
.far.fa-hand-spock:before {
content: "\f259";
}
.far.fa-handshake:before {
content: "\f2b5";
}
.far.fa-hdd:before {
content: "\f0a0";
}
.far.fa-heart:before {
content: "\f08a";
}
.far.fa-hospital:before {
content: "\f0f8";
}
.far.fa-hourglass:before {
content: "\f250";
}
.far.fa-id-card:before {
content: "\f2c3";
}
.far.fa-keyboard:before {
content: "\f11c";
}
.far.fa-lemon:before {
content: "\f094";
}
.far.fa-lightbulb:before {
content: "\f0eb";
}
.far.fa-meh:before {
content: "\f11a";
}
.far.fa-minus-square:before {
content: "\f147";
}
.far.fa-money-bill-alt:before {
content: "\f0d6";
}
.far.fa-moon:before {
content: "\f186";
}
.far.fa-newspaper:before {
content: "\f1ea";
}
.far.fa-paper-plane:before {
content: "\f1d9";
}
.far.fa-pause-circle:before {
content: "\f28c";
}
.far.fa-edit:before {
content: "\f044";
}
.far.fa-image:before {
content: "\f03e";
}
.far.fa-play-circle:before {
content: "\f01d";
}
.far.fa-plus-square:before {
content: "\f196";
}
.far.fa-question-circle:before {
content: "\f92c";
}
.far.fa-share-square:before {
content: "\f045";
}
.far.fa-smile:before {
content: "\f118";
}
.far.fa-snowflake:before {
content: "\f2dc";
}
.far.fa-futbol:before {
content: "\f1e3";
}
.far.fa-star-half:before {
content: "\f089";
}
.far.fa-star:before {
content: "\f006";
}
.far.fa-sticky-note:before {
content: "\f24a";
}
.far.fa-stop-circle:before {
content: "\f28e";
}
.far.fa-sun:before {
content: "\f185";
}
.far.fa-thumbs-down:before {
content: "\f088";
}
.far.fa-thumbs-up:before {
content: "\f087";
}
.far.fa-times-circle:before {
content: "\f05c";
}
.far.fa-window-close:before {
content: "\f2d4";
}
.far.fa-trash-alt:before {
content: "\f014";
}
.far.fa-user-circle:before {
content: "\f2be";
}
.far.fa-user:before {
content: "\f2c0";
}

File diff suppressed because one or more lines are too long

View File

@ -1 +0,0 @@
{"version":3,"sources":["v5-compat.css"],"names":[],"mappings":";;;;;;;;;;;AAaA,KACA,KAFA,KAGE,QAAA,aACA,KAAA,OAAA,OAAA,OAAA,KAAA,EAAA,YACA,UAAA,QACA,eAAA,KACA,uBAAA,YACA,wBAAA,UAEgB,0BAChB,QAAA,QAEgB,0BAChB,QAAA,QAEuB,iCACvB,QAAA,QAEkB,4BAClB,QAAA,QAEkB,4BAClB,QAAA,QAEkB,4BAClB,QAAA,QAEkB,4BAClB,QAAA,QAEwB,kCACxB,QAAA,QAEsB,gCACtB,QAAA,QAEiB,2BACjB,QAAA,QAEiB,2BACjB,QAAA,QAEe,yBACf,QAAA,QAEkB,4BAClB,QAAA,QAEuB,iCACvB,QAAA,QAE8B,wCAC9B,QAAA,QAEiB,2BACjB,QAAA,QAEgB,0BAChB,QAAA,QAEmB,6BACnB,QAAA,QAEiB,2BACjB,QAAA,QAEgB,0BAChB,QAAA,QAEc,wBACd,QAAA,QAEo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oBACA,oBACV,QAAA,QAEc,wBACd,QAAA,QAEqB,+BACrB,QAAA,QAEc,wBACd,QAAA,QAEe,yBACf,QAAA,QAEU,oBACV,QAAA,QAEU,oBACV,QAAA,QAEY,sBACZ,QAAA,QAEiB,2BACjB,QAAA,QAEW,qBACX,QAAA,QAEY,sBACZ,QAAA,QAEe,yBACf,QAAA,QAEiB,2BACjB,QAAA,QAEqB,+BACrB,QAAA,QAEqB,+BACrB,QAAA,QAEsB,gCACtB,QAAA,QAEmB,6BACnB,QAAA,QAEgB,0BAChB,QAAA,OAEkB,4BAClB,QAAA,QAEmB,6BACnB,QAAA,QAEgB,0BAChB,QAAA,QAEe,yBACf,QAAA,QAES,mBACT,QAAA,QAEW,qBACX,QAAA,QAEc,wBACd,QAAA,QAEe,yBACf,QAAA,QAEa,uBACb,QAAA,QAEc,wBACd,QAAA,QAEW,qBACX,QAAA,QAEe,yBACf,QAAA,QAES,mBACT,QAAA,QAEkB,4BAClB,QAAA,QAEoB,8BACpB,QAAA,QAEU,oBACV,QAAA,QAEe,yBACf,QAAA,QAEiB,2BACjB,QAAA,QAEkB,4BAClB,QAAA,QAEU,oBACV,QAAA,QAEW,qBACX,QAAA,QAEiB,2BACjB,QAAA,QAEiB,2BACjB,QAAA,QAEqB,+BACrB,QAAA,QAEkB,4BAClB,QAAA,QAEW,qBACX,QAAA,QAEe,yBACf,QAAA,QAEY,sBACZ,QAAA,QAEe,yBACf,QAAA,QAEU,oBACV,QAAA,QAEiB,2BACjB,QAAA,QAEiB,2BACjB,QAAA,QAES,mBACT,QAAA,QAEiB,2BACjB,QAAA,QAEe,yBACf,QAAA,QAEkB,4BAClB,QAAA,QAEkB,4BAClB,QAAA,QAEe,yBACf,QAAA,QAEiB,2BACjB,QAAA,QAEU,oBACV,QAAA"}

View File

@ -3,7 +3,7 @@ import * as instance from './instances';
// ---------- Commons
export function generateArray(obj: Object): Instance[] {
export function generateArray(obj: any): Instance[] {
const item = [];
Object.keys(obj).map((index) => item.push(obj[index]));
@ -22,7 +22,7 @@ export function getCurrentTabInfo() {
if (tabs.length === 0) return;
const tab = tabs[0] || {};
makeBtns(tab);
makeButtons(tab);
});
}
@ -33,11 +33,12 @@ function urlAssigner(instance: Instance) {
element.href = href;
}
function makeBtns(tabQuery: Query) {
function makeButtons(tabQuery: Query) {
const socialBtns = generateArray(instance);
function itemBtn(instance: Instance) {
const { name, host, post } = instance;
// Getting the host of the instance
socialBtns.map((item: Instance) => {
const { name, host, post } = item;
const element = <HTMLAnchorElement>document.getElementById(`url-${name.toLowerCase()}`);
const itemHost: any = browser.storage.sync.get(`${name.toLowerCase()}Host`); // fix this
// TODO improve regex
@ -46,10 +47,8 @@ function makeBtns(tabQuery: Query) {
itemHost.then((res: string) => {
element.href = [res[`${name.toLowerCase()}Host`] || host] + str;
});
instance.button = { id: name, href: itemHost };
}
socialBtns.map((item) => itemBtn(item));
item.button = { id: name, href: itemHost };
});
socialBtns.forEach(urlAssigner);
}

View File

@ -1,25 +1,25 @@
// import sinon from 'sinon';
// import { App } from '../lib/app';
// import * as Dom from '../lib/dom';
import sinon from 'sinon';
import { App } from '../lib/app';
import * as Dom from '../lib/dom';
// describe('testing App', () => {
// let sandboxes;
// let renderDateTime;
describe('testing App', () => {
let sandboxes;
let renderItems;
// beforeEach(() => {
// sandboxes = sinon.createSandbox();
// renderDateTime = sandboxes.stub(Dom, 'renderDateTime');
// });
beforeEach(() => {
sandboxes = sinon.createSandbox();
renderItems = sandboxes.stub(Dom, 'renderItems');
});
// afterEach(() => {
// sandboxes.restore();
// });
afterEach(() => {
sandboxes.restore();
});
// describe('testing App', () => {
// it('should return Thu Nov 19 23:00', () => {
// const app = new App();
// app.render();
// expect(renderDateTime.called).toBeTruthy();
// });
// });
// });
describe('testing App', () => {
it('app is rendered', () => {
const app = new App();
app.render();
expect(renderItems.called).toBeTruthy();
});
});
});

View File

@ -1,101 +1,14 @@
// import sinon from 'sinon';
// import { getDisplayDateTime, getPeriod, getPalette } from '../lib/utils';
import { generateArray } from '../lib/utils';
import * as instance from '../lib/instances';
// describe('testing utils', () => {
// let sandboxes;
// beforeEach(() => {
// sandboxes = sinon.createSandbox();
// sandboxes.useFakeTimers({
// now: new Date(2020, 10, 19, 23, 0),
// });
// });
// afterEach(() => {
// sandboxes.restore();
// });
// describe('testing getDisplayDateTime', () => {
// it('should return Thu Nov 19 23:00', () => {
// const actual = getDisplayDateTime();
// const expected = { date: 'Thu Nov 19', time: '23:00', period: 'night' };
// expect(actual).toEqual(expected);
// });
// it('should return Thu Nov 19 01:00', () => {
// sinon.useFakeTimers({
// now: new Date(2020, 10, 19, 1, 0),
// });
// const actual = getDisplayDateTime();
// const expected = { date: 'Thu Nov 19', time: '01:00', period: 'night' };
// expect(actual).toEqual(expected);
// });
// it('should return Thu Nov 19 23:23', () => {
// sinon.useFakeTimers({
// now: new Date(2020, 10, 19, 23, 23),
// });
// const actual = getDisplayDateTime();
// const expected = { date: 'Thu Nov 19', time: '23:23', period: 'night' };
// expect(actual).toEqual(expected);
// });
// });
// describe('testing getPeriod', () => {
// it('should return morning - 05:00 AM', () => {
// const actual = getPeriod(new Date(2020, 10, 19, 5, 0));
// const expected = 'morning';
// expect(actual).toEqual(expected);
// });
// it('should return morning - 11:59 AM', () => {
// const actual = getPeriod(new Date(2020, 10, 19, 11, 59));
// const expected = 'morning';
// expect(actual).toEqual(expected);
// });
// it('should return afternoon - 12:00 PM', () => {
// const actual = getPeriod(new Date(2020, 10, 19, 12, 0));
// const expected = 'afternoon';
// expect(actual).toEqual(expected);
// });
// it('should return afternoon - 04:59 PM', () => {
// const actual = getPeriod(new Date(2020, 10, 19, 16, 59));
// const expected = 'afternoon';
// expect(actual).toEqual(expected);
// });
// it('should return night - 05:00 PM', () => {
// const actual = getPeriod(new Date(2020, 10, 19, 17, 0));
// const expected = 'night';
// expect(actual).toEqual(expected);
// });
// it('should return night - 04:59 AM', () => {
// const actual = getPeriod(new Date(2020, 10, 19, 4, 59));
// const expected = 'night';
// expect(actual).toEqual(expected);
// });
// });
// describe('testing getPalette', () => {
// it('should return morning color code - #282e54', () => {
// const actual = getPalette('morning');
// const expected = '#282e54';
// expect(actual).toEqual(expected);
// });
// it('should return afternoon color code - #000000', () => {
// const actual = getPalette('afternoon');
// const expected = '#000000';
// expect(actual).toEqual(expected);
// });
// it('should return morning color code - #ffdd91', () => {
// const actual = getPalette('night');
// const expected = '#ffdd91';
// expect(actual).toEqual(expected);
// });
// });
// });
describe('testing utils', () => {
describe('testing generateArray', () => {
it('should return an array of instances', () => {
const actual = generateArray(instance);
const testInstances = actual.slice(1, 3); // Friendica and GNUsocial
const expected = [instance.friendica, instance.gnusocial];
expect(testInstances).toEqual(expected);
});
});
// TODO include the rest
});