mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-11-30 01:42:29 +03:00
983110d931
no issue - add eslint-plugin-ember, configure no-old-shims rule - run `eslint --fix` on `app`, `lib`, `mirage`, and `tests` to move imports to the new module imports - further cleanup of Ember globals usage - remove event-dispatcher initializer now that `canDispatchToEventManager` is deprecated
54 lines
1.6 KiB
JavaScript
54 lines
1.6 KiB
JavaScript
import EmberObject from '@ember/object';
|
|
import {describe, it} from 'mocha';
|
|
import {run} from '@ember/runloop';
|
|
import {setupTest} from 'ember-mocha';
|
|
|
|
describe('Unit: Controller: settings/general', function () {
|
|
setupTest('controller:settings/general', {
|
|
needs: [
|
|
'service:config',
|
|
'service:ghostPaths',
|
|
'service:notifications',
|
|
'service:session'
|
|
]
|
|
});
|
|
|
|
it('isDatedPermalinks should be correct', function () {
|
|
let controller = this.subject({
|
|
model: EmberObject.create({
|
|
permalinks: '/:year/:month/:day/:slug/'
|
|
})
|
|
});
|
|
|
|
expect(controller.get('isDatedPermalinks')).to.be.ok;
|
|
|
|
run(function () {
|
|
controller.set('model.permalinks', '/:slug/');
|
|
|
|
expect(controller.get('isDatedPermalinks')).to.not.be.ok;
|
|
});
|
|
});
|
|
|
|
it('setting isDatedPermalinks should switch between dated and slug', function () {
|
|
let controller = this.subject({
|
|
model: EmberObject.create({
|
|
permalinks: '/:year/:month/:day/:slug/'
|
|
})
|
|
});
|
|
|
|
run(function () {
|
|
controller.set('isDatedPermalinks', false);
|
|
|
|
expect(controller.get('isDatedPermalinks')).to.not.be.ok;
|
|
expect(controller.get('model.permalinks')).to.equal('/:slug/');
|
|
});
|
|
|
|
run(function () {
|
|
controller.set('isDatedPermalinks', true);
|
|
|
|
expect(controller.get('isDatedPermalinks')).to.be.ok;
|
|
expect(controller.get('model.permalinks')).to.equal('/:year/:month/:day/:slug/');
|
|
});
|
|
});
|
|
});
|