Ghost/ghost/admin/tests/unit/controllers/settings/general-test.js
Kevin Ansfield 983110d931 Switched from ember-cli-shims to new module imports (#779)
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
2017-08-22 14:53:26 +07:00

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/');
});
});
});