Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Time-To-Leave-481 #1067

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
Empty file added .c8rc.json:Zone.Identifier
Empty file.
Empty file.
Empty file added .editorconfig:Zone.Identifier
Empty file.
Empty file added .eslintignore:Zone.Identifier
Empty file.
Empty file added .eslintrc.json:Zone.Identifier
Empty file.
Empty file added .gitattributes:Zone.Identifier
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file added .gitignore:Zone.Identifier
Empty file.
Empty file.
Empty file added .npmrc:Zone.Identifier
Empty file.
Empty file added .prettierignore:Zone.Identifier
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file added CONTRIBUTING.md:Zone.Identifier
Empty file.
Empty file added DEVELOPMENT.md:Zone.Identifier
Empty file.
Empty file added LICENSE:Zone.Identifier
Empty file.
Empty file.
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@
<a href="docs/README-th-TH.md"><img src="https://img.shields.io/badge/th--TH-ภาษาไทย-purple" alt="เอกสารฉบับนี้มีให้บริการในรูปแบบภาษาไทย"></a>
<a href="docs/README-tr-TR.md"><img src="https://img.shields.io/badge/tr-T%C3%BCrk%C3%A7e-purple" alt="Bu belge Türkçe olarak da mevcuttur"></a>
<a href="docs/README-uk-UA.md"><img src="https://img.shields.io/badge/uk--UA-Українська-purple" alt="Документація додатку українською"></a>
<a href="docs/README-zh-CN.md"><img src="https://img.shields.io/badge/zh--CN-简体中文-purple" alt="此文档亦适用于简体中文"></a>
<a href="docs/README-zh-TW.md"><img src="https://img.shields.io/badge/zh--TW-繁體中文-purple" alt="此文檔亦適用於繁體中文"></a>
<br/>

Expand Down
Empty file added README.md:Zone.Identifier
Empty file.
Empty file added RELEASING.md:Zone.Identifier
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file added __mocks__/fs.js:Zone.Identifier
Empty file.
Empty file.
Empty file.
1 change: 1 addition & 0 deletions __tests__/__main__/import-export.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ describe('Import export', function()
const store = new Store();
const flexibleStore = new Store({name: 'flexible-store'});
const waivedWorkdays = new Store({name: 'waived-workdays'});
const workdayStore = new Store({name: 'temp-workdays'});

// TODO: Regular store is still here to test migration of dbs. Please remove on the next release.
store.clear();
Expand Down
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
1 change: 0 additions & 1 deletion __tests__/__main__/user-preferences.js
Original file line number Diff line number Diff line change
Expand Up @@ -504,7 +504,6 @@ describe('Preferences Main', () =>
assert.strictEqual(getLanguageName('th-TH'), 'ไทย');
assert.strictEqual(getLanguageName('tr-TR'), 'Türkçe');
assert.strictEqual(getLanguageName('uk-UA'), 'Українська');
assert.strictEqual(getLanguageName('zh-CN'), '简体中文');
assert.strictEqual(getLanguageName('zh-TW'), '繁體中文');
});
});
Expand Down
Empty file.
Empty file.
Empty file.
9 changes: 9 additions & 0 deletions __tests__/__renderer__/classes/BaseCalendar.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@ describe('BaseCalendar.js', () =>
flexibleStore.clear();
const waivedWorkdays = new Store({name: 'waived-workdays'});
waivedWorkdays.clear();
const workdayStore = new Store({name: 'temp-workdays'});
workdayStore.clear();
ExtendedClass.prototype._initCalendar = () => {};
ExtendedClass.prototype._getTargetDayForAllTimeBalance = () => {};

Expand All @@ -70,6 +72,13 @@ describe('BaseCalendar.js', () =>
resolve(waivedWorkdays.store);
});
};
window.mainApi.getWorkdayStoreContents = () =>
{
return new Promise((resolve) =>
{
resolve(workdayStore.store);
});
};
window.mainApi.setFlexibleStoreData = (key, contents) =>
{
flexibleStore.set(key, contents);
Expand Down
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
23 changes: 23 additions & 0 deletions __tests__/__renderer__/workday-waiver.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ const Holidays = require('date-holidays');
window.$ = require('jquery');
const {
addWaiver,
addWorkday,
populateList,
setDates,
setHours,
Expand Down Expand Up @@ -48,6 +49,7 @@ jest.mock('../../renderer/i18n-translator.js', () => ({
}));

const waiverStore = new Store({name: 'waived-workdays'});
const workdayStore = new Store({name: 'temp-workdays'});

// APIs from the preload script of the workday waiver window
window.mainApi = workdayWaiverApi;
Expand All @@ -72,6 +74,26 @@ window.mainApi.deleteWaiver = (key) =>
});
};

// Mocking with the actual access to store that main would have
window.mainApi.getWorkdayStoreContents = () => { return new Promise((resolve) => resolve(workdayStore.store)); };
window.mainApi.setWorkday = (key, contents) =>
{
return new Promise((resolve) =>
{
workdayStore.set(key, contents);
resolve(true);
});
};
window.mainApi.hasWorkday= (key) => { return new Promise((resolve) => resolve(workdayStore.has(key))); };
window.mainApi.deleteWorkday = (key) =>
{
return new Promise((resolve) =>
{
workdayStore.delete(key);
resolve(true);
});
};

window.mainApi.getHolidays = (country, state, city, year) =>
{
return new Promise((resolve) =>
Expand Down Expand Up @@ -127,6 +149,7 @@ const languageData = {'language': 'en', 'data': {'dummy_string': 'dummy_string_t
async function prepareMockup()
{
waiverStore.clear();
workdayStore.clear();
const workdayWaiverHtml = path.join(__dirname, '../../src/workday-waiver.html');
const content = fs.readFileSync(workdayWaiverHtml);
const parser = new DOMParser();
Expand Down
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file added assets/edit.svg:Zone.Identifier
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file added assets/ttl.png:Zone.Identifier
Empty file.
Empty file added assets/ttl.svg:Zone.Identifier
Empty file.
Empty file.
Empty file added babel.config.js:Zone.Identifier
Empty file.
2 changes: 0 additions & 2 deletions changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
- Fix [#1042]: Removing extra space at bottom of workday waiver window
- Fix [#1044]: Introduce Content Security Policies to app's pages
- Fix [#1047]: Fixing test issues in CI
- Translation: Time to Leave is now available in Simplified Chinese (zh-CN)!

<!--- End changes - Do not remove -->

Expand All @@ -27,7 +26,6 @@ Who built 3.0.1:
- araujoarthur0
- chase-west
- gsriram24
- nh1000
- ochan12
- pallasite99
- tupaschoal
Expand Down
Empty file added changelog.md:Zone.Identifier
Empty file.
Empty file added codecov.yml:Zone.Identifier
Empty file.
Empty file.
14 changes: 14 additions & 0 deletions css/styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -745,6 +745,20 @@ input:disabled + .slider {
color: var(--punch-disable-bground);
}

#workday-waiver-window .add-workday-button {
opacity: 0.9;
width: 100%;
height: 24px;
border: none;
color: var(--punch-color);
background-color: var(--punch-bground);
}

#workday-waiver-window .add-workday-button:disabled {
opacity: 0.5;
color: var(--punch-disable-bground);
}

#workday-waiver-window #waiver-list-table,
#workday-waiver-window #holiday-list-table {
width: 100%;
Expand Down
Empty file added css/styles.css:Zone.Identifier
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
54 changes: 0 additions & 54 deletions docs/README-zh-CN.md

This file was deleted.

Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file added esm-main.js:Zone.Identifier
Empty file.
Empty file added jest.config.js:Zone.Identifier
Empty file.
Empty file.
Empty file added js/date-aux.js:Zone.Identifier
Empty file.
Empty file.
Empty file.
Empty file.
22 changes: 22 additions & 0 deletions js/import-export.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,28 @@ function _getWaivedEntries()
return output;
}

/**
* Returns the database (only waived workday entries) as an array of:
* . type: workday
* . date
* . data: (reason)
*/
function _getWorkdayEntries()
{
const workdayStore = new Store({name: 'temp-workdays'});
const output = [];
for (const entry of workdayStore)
{
const date = entry[0];
const reason = entry[1]['reason'];
const hours = entry[1]['hours'];

//The waived workday database uses human month index (1-12)
output.push({'type': 'waived', 'date': date, 'data': reason, 'hours': hours});
}
return output;
}

function exportDatabaseToFile(filename)
{
let information = _getFlexibleEntries();
Expand Down
Empty file.
Empty file.
Empty file added js/menus.js:Zone.Identifier
Empty file.
Empty file.
Empty file.
Empty file added js/squirrel.js:Zone.Identifier
Empty file.
Empty file.
Empty file added js/time-math.js:Zone.Identifier
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file added js/windows.js:Zone.Identifier
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Loading