mirror of
https://github.com/MichMich/MagicMirror.git
synced 2025-06-27 11:50:00 +00:00
Merge branch 'develop' into unittest-calendar
This commit is contained in:
commit
18b61e35be
@ -1,5 +1,6 @@
|
||||
language: node_js
|
||||
node_js:
|
||||
- "8"
|
||||
- "7"
|
||||
- "6"
|
||||
- "5.1"
|
||||
@ -12,6 +13,8 @@ script:
|
||||
- grunt
|
||||
- npm run test:unit
|
||||
- npm run test:e2e
|
||||
after_script:
|
||||
- npm list
|
||||
cache:
|
||||
directories:
|
||||
- node_modules
|
||||
|
25
CHANGELOG.md
25
CHANGELOG.md
@ -9,16 +9,19 @@ This project adheres to [Semantic Versioning](http://semver.org/).
|
||||
### Added
|
||||
- Add `clientonly` script to start only the electron client for a remote server.
|
||||
- Add symbol and color properties of event when `CALENDAR_EVENTS` notification is broadcasted from `default/calendar` module.
|
||||
- Add `.vscode/` folder to `.gitignore` to keep custom Visual Studio Code config out of git
|
||||
- Add `.vscode/` folder to `.gitignore` to keep custom Visual Studio Code config out of git.
|
||||
- Add unit test the capitalizeFirstLetter function of newfeed module.
|
||||
- Add new unit tests for function `shorten` in calendar module.
|
||||
|
||||
### Updated
|
||||
- Changed 'default.js' - listen on all attached interfaces by default
|
||||
- Changed 'default.js' - listen on all attached interfaces by default.
|
||||
- Add execution of `npm list` after the test are ran in Travis CI.
|
||||
|
||||
### Fixed
|
||||
|
||||
- Fixed issue with incorrect allignment of analog clock when displayed in the center column of the MM
|
||||
- Fixed ipWhitelist behaviour to make empty whitelist ([]) allow any and all hosts access to the MM
|
||||
- Fixed issue with incorrect allignment of analog clock when displayed in the center column of the MM.
|
||||
- Fixed ipWhitelist behaviour to make empty whitelist ([]) allow any and all hosts access to the MM.
|
||||
- Fixed issue with calendar module where 'excludedEvents' count towards 'maximumEntries'.
|
||||
- Fixed issue with calendar module where global configuration of maximumEntries was not overridden by calendar specific config (see module doc).
|
||||
|
||||
## [2.1.2] - 2017-07-01
|
||||
|
||||
@ -48,7 +51,7 @@ This project adheres to [Semantic Versioning](http://semver.org/).
|
||||
### Updated
|
||||
- Added missing keys to Polish translation.
|
||||
- Added missing key to German translation.
|
||||
- Added better translation with flexible word order to Finnish translation
|
||||
- Added better translation with flexible word order to Finnish translation.
|
||||
|
||||
### Fixed
|
||||
- Fix instruction in README for using automatically installer script.
|
||||
@ -56,8 +59,8 @@ This project adheres to [Semantic Versioning](http://semver.org/).
|
||||
- Fix double message about port when server is starting
|
||||
- Corrected Swedish translations for TODAY/TOMORROW/DAYAFTERTOMORROW.
|
||||
- Removed unused import from js/electron.js
|
||||
- Made calendar.js respect config.timeFormat irrespecive of locale setting
|
||||
- Fixed alignment of analog clock when a large calendar is displayed in the same side bar
|
||||
- Made calendar.js respect config.timeFormat irrespecive of locale setting.
|
||||
- Fixed alignment of analog clock when a large calendar is displayed in the same side bar.
|
||||
|
||||
## [2.1.1] - 2017-04-01
|
||||
|
||||
@ -65,18 +68,18 @@ This project adheres to [Semantic Versioning](http://semver.org/).
|
||||
|
||||
### Changed
|
||||
- Add `anytime` group for Compliments module.
|
||||
- Compliments module can use remoteFile without default daytime arrays defined
|
||||
- Compliments module can use remoteFile without default daytime arrays defined.
|
||||
- Installer: Use init config.js from config.js.sample.
|
||||
- Switched out `rrule` package for `rrule-alt` and fixes in `ical.js` in order to fix calendar issues. ([#565](https://github.com/MichMich/MagicMirror/issues/565))
|
||||
- Make mouse events pass through the region fullscreen_above to modules below.
|
||||
- Scaled the splash screen down to make it a bit more subtle.
|
||||
- Replace HTML tables with markdown tables in README files.
|
||||
- Added `DAYAFTERTOMORROW`, `UPDATE_NOTIFICATION` and `UPDATE_NOTIFICATION_MODULE` to Finnish translations.
|
||||
- Run `npm test` on Travis automatically
|
||||
- Run `npm test` on Travis automatically.
|
||||
- Show the splash screen image even when is reboot or halted.
|
||||
- Added some missing translaton strings in the sv.json file.
|
||||
- Run task jsonlint to check translation files.
|
||||
- Restructured Test Suite
|
||||
- Restructured Test Suite.
|
||||
|
||||
### Added
|
||||
- Added Docker support (Pull Request [#673](https://github.com/MichMich/MagicMirror/pull/673)).
|
||||
|
@ -153,20 +153,6 @@ Module.register("calendar", {
|
||||
|
||||
for (var e in events) {
|
||||
var event = events[e];
|
||||
|
||||
var excluded = false;
|
||||
for (var f in this.config.excludedEvents) {
|
||||
var filter = this.config.excludedEvents[f];
|
||||
if (event.title.toLowerCase().includes(filter.toLowerCase())) {
|
||||
excluded = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (excluded) {
|
||||
continue;
|
||||
}
|
||||
|
||||
var eventWrapper = document.createElement("tr");
|
||||
|
||||
if (this.config.colored) {
|
||||
@ -366,7 +352,7 @@ Module.register("calendar", {
|
||||
return a.startDate - b.startDate;
|
||||
});
|
||||
|
||||
return events.slice(0, this.config.maximumEntries);
|
||||
return events;
|
||||
},
|
||||
|
||||
/* createEventList(url)
|
||||
@ -377,6 +363,7 @@ Module.register("calendar", {
|
||||
addCalendar: function (url, auth, calendarConfig) {
|
||||
this.sendSocketNotification("ADD_CALENDAR", {
|
||||
url: url,
|
||||
excludedEvents: calendarConfig.excludedEvents || this.config.excludedEvents,
|
||||
maximumEntries: calendarConfig.maximumEntries || this.config.maximumEntries,
|
||||
maximumNumberOfDays: calendarConfig.maximumNumberOfDays || this.config.maximumNumberOfDays,
|
||||
fetchInterval: this.config.fetchInterval,
|
||||
|
@ -8,7 +8,7 @@
|
||||
var ical = require("./vendor/ical.js");
|
||||
var moment = require("moment");
|
||||
|
||||
var CalendarFetcher = function(url, reloadInterval, maximumEntries, maximumNumberOfDays, auth) {
|
||||
var CalendarFetcher = function(url, reloadInterval, excludedEvents, maximumEntries, maximumNumberOfDays, auth) {
|
||||
var self = this;
|
||||
|
||||
var reloadTimer = null;
|
||||
@ -113,6 +113,19 @@ var CalendarFetcher = function(url, reloadInterval, maximumEntries, maximumNumbe
|
||||
title = event.description;
|
||||
}
|
||||
|
||||
var excluded = false;
|
||||
for (var f in excludedEvents) {
|
||||
var filter = excludedEvents[f];
|
||||
if (title.toLowerCase().includes(filter.toLowerCase())) {
|
||||
excluded = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (excluded) {
|
||||
continue;
|
||||
}
|
||||
|
||||
var location = event.location || false;
|
||||
var geo = event.geo || false;
|
||||
var description = event.description || false;
|
||||
|
@ -24,7 +24,7 @@ module.exports = NodeHelper.create({
|
||||
socketNotificationReceived: function(notification, payload) {
|
||||
if (notification === "ADD_CALENDAR") {
|
||||
//console.log('ADD_CALENDAR: ');
|
||||
this.createFetcher(payload.url, payload.fetchInterval, payload.maximumEntries, payload.maximumNumberOfDays, payload.auth);
|
||||
this.createFetcher(payload.url, payload.fetchInterval, payload.excludedEvents, payload.maximumEntries, payload.maximumNumberOfDays, payload.auth);
|
||||
}
|
||||
},
|
||||
|
||||
@ -36,7 +36,7 @@ module.exports = NodeHelper.create({
|
||||
* attribute reloadInterval number - Reload interval in milliseconds.
|
||||
*/
|
||||
|
||||
createFetcher: function(url, fetchInterval, maximumEntries, maximumNumberOfDays, auth) {
|
||||
createFetcher: function(url, fetchInterval, excludedEvents, maximumEntries, maximumNumberOfDays, auth) {
|
||||
var self = this;
|
||||
|
||||
if (!validUrl.isUri(url)) {
|
||||
@ -47,7 +47,7 @@ module.exports = NodeHelper.create({
|
||||
var fetcher;
|
||||
if (typeof self.fetchers[url] === "undefined") {
|
||||
console.log("Create new calendar fetcher for url: " + url + " - Interval: " + fetchInterval);
|
||||
fetcher = new CalendarFetcher(url, fetchInterval, maximumEntries, maximumNumberOfDays, auth);
|
||||
fetcher = new CalendarFetcher(url, fetchInterval, excludedEvents, maximumEntries, maximumNumberOfDays, auth);
|
||||
|
||||
fetcher.onReceive(function(fetcher) {
|
||||
//console.log('Broadcast events.');
|
||||
|
@ -14,8 +14,10 @@ describe("Functions into modules/default/calendar/calendar.js", function() {
|
||||
Module.definitions[name] = moduleDefinition;
|
||||
};
|
||||
|
||||
// load calendar.js
|
||||
require("../../../modules/default/calendar/calendar.js");
|
||||
before(function() {
|
||||
// load calendar.js
|
||||
require("../../../modules/default/calendar/calendar.js");
|
||||
});
|
||||
|
||||
describe("capFirst", function() {
|
||||
words = {
|
||||
|
37
tests/unit/functions/newsfeed_spec.js
Normal file
37
tests/unit/functions/newsfeed_spec.js
Normal file
@ -0,0 +1,37 @@
|
||||
var fs = require("fs");
|
||||
var path = require("path");
|
||||
var chai = require("chai");
|
||||
var expect = chai.expect;
|
||||
var vm = require("vm");
|
||||
|
||||
|
||||
describe("Functions into modules/default/newsfeed/newsfeed.js", function() {
|
||||
|
||||
Module = {}
|
||||
Module.definitions = {};
|
||||
Module.register = function (name, moduleDefinition) {
|
||||
Module.definitions[name] = moduleDefinition;
|
||||
};
|
||||
|
||||
// load newsfeed.js
|
||||
require("../../../modules/default/newsfeed/newsfeed.js");
|
||||
|
||||
describe("capitalizeFirstLetter", function() {
|
||||
words = {
|
||||
"rodrigo": "Rodrigo",
|
||||
"123m": "123m",
|
||||
"magic mirror": "Magic mirror",
|
||||
",a": ",a",
|
||||
"ñandú": "Ñandú",
|
||||
".!": ".!"
|
||||
};
|
||||
|
||||
Object.keys(words).forEach(word => {
|
||||
it(`for ${word} should return ${words[word]}`, function() {
|
||||
expect(Module.definitions.newsfeed.capitalizeFirstLetter(word)).to.equal(words[word]);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
});
|
||||
|
Loading…
x
Reference in New Issue
Block a user