diff --git a/allure-generator/src/main/javascript/components/widgets-grid/WidgetsGridView.js b/allure-generator/src/main/javascript/components/widgets-grid/WidgetsGridView.js
index 1635a059b..562b032fc 100644
--- a/allure-generator/src/main/javascript/components/widgets-grid/WidgetsGridView.js
+++ b/allure-generator/src/main/javascript/components/widgets-grid/WidgetsGridView.js
@@ -2,10 +2,9 @@ import './styles.scss';
import {View} from 'backbone.marionette';
import $ from 'jquery';
import Sortable from 'sortablejs';
-import settings from '../../util/settings';
import {className} from '../../decorators';
-import pluginsRegistry from '../../util/pluginsRegistry';
-//import {fetchAndShow} from '../../util/loading';
+import pluginsRegistry from '../../utils/pluginsRegistry';
+import {getSettingsForWidgetGridPlugin} from '../../utils/settingsFactory';
const widgetTpl = (id) => `
@@ -20,8 +19,9 @@ const colTpl = '
';
class WidgetsGridView extends View {
template = () => '';
- initialize() {
+ initialize({settings = getSettingsForWidgetGridPlugin('overview')}) {
this.widgets = pluginsRegistry.widgets[this.options.tabName];
+ this.settings = settings;
}
onRender() {
@@ -43,7 +43,7 @@ class WidgetsGridView extends View {
}
getWidgetsArrangement() {
- const savedData = settings.get('widgets') || [[], []];
+ const savedData = this.settings.getWidgetsArrangement();
const storedWidgets = savedData.map(col => {
return col.filter(widgetName => this.widgets[widgetName]);
@@ -60,7 +60,7 @@ class WidgetsGridView extends View {
}
saveWidgetsArrangement() {
- settings.save('widgets', this.$('.widgets-grid__col').toArray().map(colEl => {
+ this.settings.setWidgetsArrangement(this.$('.widgets-grid__col').toArray().map(colEl => {
return $(colEl).find('.widget').toArray().map(el => $(el).data('id'));
}));
}
@@ -70,7 +70,7 @@ class WidgetsGridView extends View {
col.append(el);
this.addRegion(name, {el: el.find('.widget__body')});
- /// fetchAndShow(this, name, this.model, new Widget({model: this.model}))
+ /// fetchAndShow(this, name, this.model, new Widget({model: this.model}))
const model = this.model;
this.getRegion(name).show(new Widget({model, name}));
}
diff --git a/allure-generator/src/main/javascript/data/localstorage/LocalStorageModel.js b/allure-generator/src/main/javascript/data/localstorage/LocalStorageModel.js
new file mode 100644
index 000000000..1e5f2bb06
--- /dev/null
+++ b/allure-generator/src/main/javascript/data/localstorage/LocalStorageModel.js
@@ -0,0 +1,25 @@
+import {Model} from 'backbone';
+
+export default class LocalStorageModel extends Model {
+
+ storageKey() {
+ return 'ALLURE_REPORT_SETTINGS';
+ }
+
+ fetch() {
+ return new Promise(resolve => {
+ const settings = window.localStorage.getItem(this.storageKey());
+ if (settings) {
+ this.set(JSON.parse(settings));
+ }
+ resolve();
+ });
+ }
+
+ save(key, val) {
+ this.set(key, val);
+ const json = this.toJSON();
+ window.localStorage.setItem(this.storageKey(), JSON.stringify(json));
+ }
+
+}
\ No newline at end of file
diff --git a/allure-generator/src/main/javascript/data/report/ReportModel.js b/allure-generator/src/main/javascript/data/report/ReportModel.js
deleted file mode 100644
index 44167b4f2..000000000
--- a/allure-generator/src/main/javascript/data/report/ReportModel.js
+++ /dev/null
@@ -1,12 +0,0 @@
-import {Model} from 'backbone';
-
-export default class ReportModel extends Model {
- url = 'data/report.json';
-
- fetch(...args) {
- if(!this.fetchPromise) {
- this.fetchPromise = super.fetch(...args);
- }
- return new Promise((res, rej) => this.fetchPromise.then(res, rej));
- }
-}
diff --git a/allure-generator/src/main/javascript/data/settings/createSettingsModel.js b/allure-generator/src/main/javascript/data/settings/createSettingsModel.js
deleted file mode 100644
index 7cd53cb0f..000000000
--- a/allure-generator/src/main/javascript/data/settings/createSettingsModel.js
+++ /dev/null
@@ -1,41 +0,0 @@
-import {Model} from 'backbone';
-
-
-export default function createSettingsModel(pluginName, defaults) {
- let storageKey = 'allure2Settings';
- if(pluginName) {
- storageKey += `-${pluginName}`;
- }
-
- return class SettingsModel extends Model {
-
- defaults() {
- return defaults;
- }
-
- fetch() {
- return new Promise(resolve => {
- const settings = window.localStorage.getItem(storageKey);
- if(settings) {
- this.set(JSON.parse(settings));
- }
- resolve();
- });
- }
-
- save(key, val) {
- this.set(key, val);
- const json = this.toJSON();
- window.localStorage.setItem(storageKey, JSON.stringify(json));
- }
-
- getVisibleStatuses(key) {
- return this.get(key) || this.get('visibleStatuses');
- }
-
- getTreeSorting(key) {
- return this.get(key) || {ascending: true, sorter: 'sorter.name'};
- }
- };
-}
-
diff --git a/allure-generator/src/main/javascript/data/testresult/TestResultModel.js b/allure-generator/src/main/javascript/data/testresult/TestResultModel.js
index c2b6da5fe..8af94424d 100644
--- a/allure-generator/src/main/javascript/data/testresult/TestResultModel.js
+++ b/allure-generator/src/main/javascript/data/testresult/TestResultModel.js
@@ -1,6 +1,6 @@
import {findWhere} from 'underscore';
import {Model} from 'backbone';
-import {makeArray} from '../../util/arrays';
+import {makeArray} from '../../utils/arrays';
function collectAttachments({steps, attachments}) {
diff --git a/allure-generator/src/main/javascript/data/tree/TreeCollection.js b/allure-generator/src/main/javascript/data/tree/TreeCollection.js
index 0d9f24481..57bd6fbbb 100644
--- a/allure-generator/src/main/javascript/data/tree/TreeCollection.js
+++ b/allure-generator/src/main/javascript/data/tree/TreeCollection.js
@@ -1,6 +1,6 @@
import {Collection} from 'backbone';
import {flatten, findWhere} from 'underscore';
-import {values} from '../../util/statuses';
+import {values} from '../../utils/statuses';
function updateTime(timeA, timeB, field, operation) {
if (timeB && timeB[field]) {
diff --git a/allure-generator/src/main/javascript/data/tree/comparator.js b/allure-generator/src/main/javascript/data/tree/comparator.js
index 0cb48700e..623e80b55 100644
--- a/allure-generator/src/main/javascript/data/tree/comparator.js
+++ b/allure-generator/src/main/javascript/data/tree/comparator.js
@@ -1,4 +1,4 @@
-import {values} from '../../util/statuses';
+import {values} from '../../utils/statuses';
function byName(a, b) {
return a.name.toLowerCase() < b.name.toLowerCase() ? -1 : 1;
diff --git a/allure-generator/src/main/javascript/helpers/fileicon.js b/allure-generator/src/main/javascript/helpers/fileicon.js
index 91ed0a2fa..085e5a45a 100644
--- a/allure-generator/src/main/javascript/helpers/fileicon.js
+++ b/allure-generator/src/main/javascript/helpers/fileicon.js
@@ -1,4 +1,4 @@
-import typeByMime from '../util/attachmentType';
+import typeByMime from '../utils/attachmentType';
export default function(type) {
return typeByMime(type).icon;
diff --git a/allure-generator/src/main/javascript/helpers/statistic-bar.js b/allure-generator/src/main/javascript/helpers/statistic-bar.js
index a08a59507..65576d09d 100644
--- a/allure-generator/src/main/javascript/helpers/statistic-bar.js
+++ b/allure-generator/src/main/javascript/helpers/statistic-bar.js
@@ -1,13 +1,10 @@
import {SafeString} from 'handlebars/runtime';
-import settings from '../util/settings';
-import {values} from '../util/statuses';
+import {values} from '../utils/statuses';
-export default function (statistic, tabName){
- const statusesKey = tabName + '.visibleStatuses';
- const statuses = settings.getVisibleStatuses(statusesKey);
+export default function (statistic){
const fill = values.map(status => {
const count = !statistic || typeof statistic[status] === 'undefined' ? 0 : statistic[status];
- return count === 0 || !statuses[status]
+ return count === 0
? ''
: `
${count} `;
}
diff --git a/allure-generator/src/main/javascript/helpers/status-bar.js b/allure-generator/src/main/javascript/helpers/status-bar.js
index 3c84af003..74c698061 100644
--- a/allure-generator/src/main/javascript/helpers/status-bar.js
+++ b/allure-generator/src/main/javascript/helpers/status-bar.js
@@ -1,5 +1,5 @@
import {SafeString} from 'handlebars/runtime';
-import {values} from '../util/statuses';
+import {values} from '../utils/statuses';
export default function statusBar(statistic) {
const fill = values.map(status => {
diff --git a/allure-generator/src/main/javascript/helpers/t.js b/allure-generator/src/main/javascript/helpers/t.js
index 5efebcc53..79b9998fa 100644
--- a/allure-generator/src/main/javascript/helpers/t.js
+++ b/allure-generator/src/main/javascript/helpers/t.js
@@ -1,4 +1,4 @@
-import i18next from '../util/translation';
+import i18next from '../utils/translation';
export default function translate(key, options) {
return i18next.t(key, options ? options.hash : {});
diff --git a/allure-generator/src/main/javascript/pluginApi.js b/allure-generator/src/main/javascript/pluginApi.js
index f6d54d00d..d448d96ea 100644
--- a/allure-generator/src/main/javascript/pluginApi.js
+++ b/allure-generator/src/main/javascript/pluginApi.js
@@ -1,17 +1,16 @@
-import pluginsRegistry from './util/pluginsRegistry';
+import pluginsRegistry from './utils/pluginsRegistry';
import TreeLayout from './layouts/tree/TreeLayout';
import AppLayout from './layouts/application/AppLayout';
import WidgetStatusView from './components/widget-status/WidgetStatusView';
-import createSettingsModel from './data/settings/createSettingsModel';
+import {getSettingsForPlugin} from './utils/settingsFactory';
+import settings from './utils/settings';
window.allure = {
api: pluginsRegistry,
getPluginSettings(name, defaults) {
- const SettingsModel = createSettingsModel(name, defaults);
- const settings = new SettingsModel();
- settings.fetch();
- return settings;
+ return getSettingsForPlugin(name, defaults);
},
+ settings: settings,
components: {
AppLayout: AppLayout,
TreeLayout: TreeLayout,
diff --git a/allure-generator/src/main/javascript/plugins/default/index.js b/allure-generator/src/main/javascript/plugins/default/index.js
index 3931ea453..09542c9ff 100644
--- a/allure-generator/src/main/javascript/plugins/default/index.js
+++ b/allure-generator/src/main/javascript/plugins/default/index.js
@@ -3,5 +3,7 @@ import OverviewLayout from '../../layouts/overview/OverviewLayout';
allure.api.addTab('', {
title: 'tab.overview.name', icon: 'fa fa-home',
route: '',
- onEnter: () => new OverviewLayout()
+ onEnter: () => new OverviewLayout({
+ tabName: 'tab.overview.name'
+ })
});
diff --git a/allure-generator/src/main/javascript/plugins/tab-timeline/TimelineView.js b/allure-generator/src/main/javascript/plugins/tab-timeline/TimelineView.js
index 62196f14a..af2242a0d 100644
--- a/allure-generator/src/main/javascript/plugins/tab-timeline/TimelineView.js
+++ b/allure-generator/src/main/javascript/plugins/tab-timeline/TimelineView.js
@@ -10,7 +10,7 @@ import {select, event as currentEvent} from 'd3-selection';
import {brushX} from 'd3-brush';
import {drag} from 'd3-drag';
import 'd3-selection-multi';
-import escape from '../../util/escape';
+import escape from '../../utils/escape';
import TooltipView from '../../components/tooltip/TooltipView';
import template from './TimelineView.hbs';
import {axisBottom} from 'd3-axis';
diff --git a/allure-generator/src/main/javascript/util/settings.js b/allure-generator/src/main/javascript/util/settings.js
deleted file mode 100644
index 3529963d4..000000000
--- a/allure-generator/src/main/javascript/util/settings.js
+++ /dev/null
@@ -1,22 +0,0 @@
-import createSettingsModel from '../data/settings/createSettingsModel';
-
-const GlobalSettingsModel = createSettingsModel(null, {
- language: 'en',
- testResultSorting: {
- field: 'index',
- order: 'asc'
- },
- sidebarCollapsed: false,
- visibleStatuses: {
- failed: true,
- broken: true,
- skipped: true,
- unknown: true,
- passed: true
- },
- showGroupInfo: false
-});
-const settings = new GlobalSettingsModel();
-settings.fetch();
-
-export default settings;
diff --git a/allure-generator/src/main/javascript/util/arrays.js b/allure-generator/src/main/javascript/utils/arrays.js
similarity index 100%
rename from allure-generator/src/main/javascript/util/arrays.js
rename to allure-generator/src/main/javascript/utils/arrays.js
diff --git a/allure-generator/src/main/javascript/util/attachmentType.js b/allure-generator/src/main/javascript/utils/attachmentType.js
similarity index 100%
rename from allure-generator/src/main/javascript/util/attachmentType.js
rename to allure-generator/src/main/javascript/utils/attachmentType.js
diff --git a/allure-generator/src/main/javascript/util/clipboard.js b/allure-generator/src/main/javascript/utils/clipboard.js
similarity index 100%
rename from allure-generator/src/main/javascript/util/clipboard.js
rename to allure-generator/src/main/javascript/utils/clipboard.js
diff --git a/allure-generator/src/main/javascript/util/escape.js b/allure-generator/src/main/javascript/utils/escape.js
similarity index 100%
rename from allure-generator/src/main/javascript/util/escape.js
rename to allure-generator/src/main/javascript/utils/escape.js
diff --git a/allure-generator/src/main/javascript/util/highlight.js b/allure-generator/src/main/javascript/utils/highlight.js
similarity index 100%
rename from allure-generator/src/main/javascript/util/highlight.js
rename to allure-generator/src/main/javascript/utils/highlight.js
diff --git a/allure-generator/src/main/javascript/util/hotkeys.js b/allure-generator/src/main/javascript/utils/hotkeys.js
similarity index 100%
rename from allure-generator/src/main/javascript/util/hotkeys.js
rename to allure-generator/src/main/javascript/utils/hotkeys.js
diff --git a/allure-generator/src/main/javascript/util/loading.js b/allure-generator/src/main/javascript/utils/loading.js
similarity index 100%
rename from allure-generator/src/main/javascript/util/loading.js
rename to allure-generator/src/main/javascript/utils/loading.js
diff --git a/allure-generator/src/main/javascript/util/pluginsRegistry.js b/allure-generator/src/main/javascript/utils/pluginsRegistry.js
similarity index 100%
rename from allure-generator/src/main/javascript/util/pluginsRegistry.js
rename to allure-generator/src/main/javascript/utils/pluginsRegistry.js
diff --git a/allure-generator/src/main/javascript/utils/settings.js b/allure-generator/src/main/javascript/utils/settings.js
new file mode 100644
index 000000000..0a34d3bc6
--- /dev/null
+++ b/allure-generator/src/main/javascript/utils/settings.js
@@ -0,0 +1,4 @@
+import {getGlobalSettings} from './settingsFactory';
+
+const globalSettings = getGlobalSettings();
+export default globalSettings;
diff --git a/allure-generator/src/main/javascript/utils/settingsFactory.js b/allure-generator/src/main/javascript/utils/settingsFactory.js
new file mode 100644
index 000000000..31511bf54
--- /dev/null
+++ b/allure-generator/src/main/javascript/utils/settingsFactory.js
@@ -0,0 +1,131 @@
+import LocalStorageModel from '../data/localstorage/LocalStorageModel';
+
+const globalSettingsDefaults = {
+ language: 'en',
+ sidebarCollapsed: false
+};
+
+const treePluginDefaults = {
+ visibleStatuses: {
+ failed: true,
+ broken: true,
+ skipped: true,
+ unknown: true,
+ passed: true
+ },
+ showGroupInfo: false,
+ treeSorting: {
+ ascending: true,
+ sorter: 'sorter.name'
+ }
+};
+
+const widgetGridPluginDefaults = {
+ widgets: [[], []]
+};
+
+function getGlobalSettings() {
+ const SettingsModel = LocalStorageModel.extend({
+ defaults() {
+ return globalSettingsDefaults;
+ },
+
+ getLanguage() {
+ return this.get('language');
+ },
+
+ setLanguage(value) {
+ return this.save('language', value);
+ },
+
+ isSidebarCollapsed() {
+ return this.get('sidebarCollapsed');
+ },
+
+ setSidebarCollapsed(value) {
+ return this.save('sidebarCollapsed', value);
+ }
+ });
+ const settings = new SettingsModel();
+ settings.fetch();
+ return settings;
+}
+
+function getSettingsForPlugin(pluginName, defaults = {}) {
+ const SettingsModel = LocalStorageModel.extend({
+ storageKey() {
+ return `ALLURE_REPORT_SETTINGS_${pluginName.toUpperCase()}`;
+ },
+ defaults() {
+ return defaults;
+ },
+ });
+ const settings = new SettingsModel();
+ settings.fetch();
+ return settings;
+}
+
+function getSettingsForWidgetGridPlugin(pluginName, defaults = widgetGridPluginDefaults) {
+ const SettingsModel = LocalStorageModel.extend({
+ storageKey() {
+ return `ALLURE_REPORT_SETTINGS_${pluginName.toUpperCase()}`;
+ },
+ defaults() {
+ return defaults;
+ },
+ getWidgetsArrangement() {
+ return this.get('widgets');
+ },
+ setWidgetsArrangement(value) {
+ this.save('widgets', value);
+ }
+ });
+ const settings = new SettingsModel();
+ settings.fetch();
+ return settings;
+}
+
+function getSettingsForTreePlugin(pluginName, defaults = treePluginDefaults) {
+ const SettingsModel = LocalStorageModel.extend({
+ storageKey() {
+ return `ALLURE_REPORT_SETTINGS_${pluginName.toUpperCase()}`;
+ },
+ defaults() {
+ return defaults;
+ },
+
+ getVisibleStatuses() {
+ return this.get('visibleStatuses');
+ },
+
+ setVisibleStatuses(value) {
+ return this.save('visibleStatuses', value);
+ },
+
+ getTreeSorting() {
+ return this.get('treeSorting');
+ },
+
+ setTreeSorting(value) {
+ this.save('treeSorting', value);
+ },
+
+ isShowGroupInfo() {
+ return this.get('showGroupInfo');
+ },
+
+ setShowGroupInfo(value) {
+ this.save('showGroupInfo', value);
+ }
+ });
+ const settings = new SettingsModel();
+ settings.fetch();
+ return settings;
+}
+
+export {
+ getGlobalSettings,
+ getSettingsForPlugin,
+ getSettingsForTreePlugin,
+ getSettingsForWidgetGridPlugin
+};
\ No newline at end of file
diff --git a/allure-generator/src/main/javascript/util/sorting.js b/allure-generator/src/main/javascript/utils/sorting.js
similarity index 100%
rename from allure-generator/src/main/javascript/util/sorting.js
rename to allure-generator/src/main/javascript/utils/sorting.js
diff --git a/allure-generator/src/main/javascript/util/statuses.js b/allure-generator/src/main/javascript/utils/statuses.js
similarity index 100%
rename from allure-generator/src/main/javascript/util/statuses.js
rename to allure-generator/src/main/javascript/utils/statuses.js
diff --git a/allure-generator/src/main/javascript/util/translation.js b/allure-generator/src/main/javascript/utils/translation.js
similarity index 100%
rename from allure-generator/src/main/javascript/util/translation.js
rename to allure-generator/src/main/javascript/utils/translation.js
diff --git a/allure-generator/src/main/javascript/variables.scss b/allure-generator/src/main/javascript/variables.scss
index 61c03bf71..6f1dac076 100644
--- a/allure-generator/src/main/javascript/variables.scss
+++ b/allure-generator/src/main/javascript/variables.scss
@@ -59,9 +59,14 @@ $sidebar-text-shadow-color: #000;
$link-color: #000;
$link-color-hover: #f00;
+
/* Pane set */
$pane-bg-color: #fff;
$pane-shadow-color: #999;
$pane-overlay-bg: rgba(240, 240, 240, 0.4);
-$pane-overlay-bg-hover: rgba(240, 240, 240, 0.2);
+$pane-overlay-bg-hover: rgba(240, 240, 240, 0.2);
+
+/* Tooltip */
+$tooltip-bg: rgba(50, 50, 50, 0.8);
+$tooltip-color: #fff;
diff --git a/allure-generator/src/test/javascript/components/status-toggle.spec.js b/allure-generator/src/test/javascript/components/status-toggle.spec.js
index b35c35ae5..cc05d684d 100644
--- a/allure-generator/src/test/javascript/components/status-toggle.spec.js
+++ b/allure-generator/src/test/javascript/components/status-toggle.spec.js
@@ -1,9 +1,9 @@
-import settings from 'util/settings';
import StatusToggleView from 'components/status-toggle/StatusToggleView';
+import {getSettingsForTreePlugin} from 'utils/settingsFactory';
describe('StatusToggle', function () {
- const statusesKey = 'testStatusKey';
const statistic = {failed: '4', broken: '3', passed: '2', skipped: '1', unknown: '0'};
+ const settings = getSettingsForTreePlugin('ALLURE_TEST');
function StatusElement(el) {
this.activeItems = () => el.find('.status-toggle__item').find('.y-label').toArray().map(item => item.textContent.trim());
@@ -12,8 +12,8 @@ describe('StatusToggle', function () {
}
beforeEach(() => {
- settings.set(statusesKey, {failed: true, broken: true, passed: false, skipped: false, unknown: false});
- this.view = new StatusToggleView({statusesKey, statistic});
+ settings.setVisibleStatuses({failed: true, broken: true, passed: false, skipped: false, unknown: false});
+ this.view = new StatusToggleView({settings, statistic});
this.view.render();
this.el = new StatusElement(this.view.$el);
});
@@ -25,9 +25,9 @@ describe('StatusToggle', function () {
it('should update model on click', () => {
this.el.passed().click();
- expect(settings.get(statusesKey)).toEqual({failed: true, broken: true, passed: true, skipped:false, unknown: false});
+ expect(settings.getVisibleStatuses()).toEqual({failed: true, broken: true, passed: true, skipped:false, unknown: false});
this.el.passed().click();
- expect(settings.get(statusesKey)).toEqual({failed: true, broken: true, passed: false, skipped:false, unknown: false});
+ expect(settings.getVisibleStatuses()).toEqual({failed: true, broken: true, passed: false, skipped:false, unknown: false});
});
});
diff --git a/allure-generator/src/test/javascript/components/tree.spec.js b/allure-generator/src/test/javascript/components/tree.spec.js
index a85c58d58..08330eb0a 100644
--- a/allure-generator/src/test/javascript/components/tree.spec.js
+++ b/allure-generator/src/test/javascript/components/tree.spec.js
@@ -1,14 +1,11 @@
import {Model} from 'backbone';
import TreeView from 'components/tree/TreeView';
import TreeCollection from 'data/tree/TreeCollection';
-import settings from 'util/settings';
-
+import {getSettingsForTreePlugin} from 'utils/settingsFactory';
describe('Tree', function () {
const tabName = 'Tab Name';
- const sorterSettingsKey = tabName + '.treeSorting';
- const filterSettingsKey = tabName + '.visibleStatuses';
- const infoSettingsKey = 'showGroupInfo';
+ let settings = getSettingsForTreePlugin('TREE_TEST');
let view;
let page;
@@ -45,11 +42,11 @@ describe('Tree', function () {
}
function sortTree({sorter = 'sorter.name', ascending = true}) {
- settings.save(sorterSettingsKey, {sorter, ascending});
+ settings.setTreeSorting({sorter, ascending});
}
function filterTree({failed = true, broken = true, passed = true, skipped = true, unknown = true}) {
- settings.save(filterSettingsKey, {
+ settings.setVisibleStatuses({
failed: failed,
broken: broken,
passed: passed,
@@ -68,6 +65,7 @@ describe('Tree', function () {
routeState: new Model(),
tabName: tabName,
baseUrl: 'XUnit',
+ settings: settings
}).render();
view.onRender();
const page = new PageObject(view.$el);
@@ -96,9 +94,7 @@ describe('Tree', function () {
});
beforeEach(() => {
- settings.unset(sorterSettingsKey);
- settings.unset(filterSettingsKey);
- settings.unset(infoSettingsKey);
+ settings = getSettingsForTreePlugin('TREE_TEST');
({view, page} = renderView(data));
});
@@ -113,7 +109,7 @@ describe('Tree', function () {
expect(page.nodes().length).toBe(0);
sortTree({ascending: false});
filterTree({failed: true, broken: false, passed: false, skipped: false, unknown: false});
- settings.save(infoSettingsKey, true);
+ settings.setShowGroupInfo(true);
expect(page.nodes().length).toBe(0);
view.destroy();
});
@@ -184,9 +180,9 @@ describe('Tree', function () {
describe('groupInfo', () => {
it('should showing and hiding the group node info', () => {
- settings.save(infoSettingsKey, true);
+ settings.setShowGroupInfo(true);
expect(page.infos().length).toBe(2);
- settings.save(infoSettingsKey, false);
+ settings.setShowGroupInfo(false);
expect(page.infos().length).toBe(0);
});
});
diff --git a/allure-generator/src/test/javascript/components/widgets-grid.spec.js b/allure-generator/src/test/javascript/components/widgets-grid.spec.js
index c93cd4628..0ee8119e3 100644
--- a/allure-generator/src/test/javascript/components/widgets-grid.spec.js
+++ b/allure-generator/src/test/javascript/components/widgets-grid.spec.js
@@ -1,18 +1,18 @@
import {View} from 'backbone';
-import settings from 'util/settings';
-import pluginsRegistry from 'util/pluginsRegistry';
+import pluginsRegistry from 'utils/pluginsRegistry';
import WidgetsGridView from 'components/widgets-grid/WidgetsGridView';
import WidgetsModel from 'data/widgets/WidgetsModel';
+import {getSettingsForWidgetGridPlugin} from 'utils/settingsFactory';
describe('WidgetsGridView', function() {
+ let settings = getSettingsForWidgetGridPlugin('ALLURE_TEST');
function PageObject(el) {
this.column = (i) => el.find('.widgets-grid__col').eq(i);
this.widgetsAtCol = (i) => this.column(i).find('.widget');
- this.widgetById = (id) => el.find(`[data-id=${id}]`);
}
beforeEach(() => {
- settings.clear();
+ settings = getSettingsForWidgetGridPlugin('ALLURE_TEST');
pluginsRegistry.widgets = {
group: {
a: View,
@@ -29,7 +29,7 @@ describe('WidgetsGridView', function() {
c: {}
}
});
- this.view = new WidgetsGridView({model: this.model, tabName: 'group'}).render();
+ this.view = new WidgetsGridView({model: this.model, tabName: 'group', settings: settings}).render();
this.view.onRender();
this.el = new PageObject(this.view.$el);
});
@@ -55,7 +55,7 @@ describe('WidgetsGridView', function() {
});
it('should add remaining widgets and ignore missing', () => {
- settings.set('widgets', [['a', 'x', 'c'], ['d', 'e']]);
+ settings.setWidgetsArrangement([['a', 'x', 'c'], ['d', 'e']]);
expect(this.view.getWidgetsArrangement()).toEqual([
['a', 'c', 'b'],
['d', 'e']