Ghost/ghost/admin/tests/unit/models/navigation-item-test.js

66 lines
1.7 KiB
JavaScript
Raw Normal View History

/* jshint expr:true */
2016-11-24 01:50:57 +03:00
import {describe, it} from 'mocha';
import {expect} from 'chai';
2016-11-24 01:50:57 +03:00
import {setupTest} from 'ember-mocha';
2016-11-24 01:50:57 +03:00
describe('Unit: Model: navigation-item', function() {
setupTest('model:navigation-item', {
// Specify the other units that are required for this test.
needs: []
2016-11-24 01:50:57 +03:00
});
2016-11-24 01:50:57 +03:00
it('isComplete is true when label and url are filled', function () {
let model = this.subject();
2016-11-24 01:50:57 +03:00
model.set('label', 'test');
model.set('url', 'test');
2016-11-24 01:50:57 +03:00
expect(model.get('isComplete')).to.be.true;
});
2016-11-24 01:50:57 +03:00
it('isComplete is false when label is blank', function () {
let model = this.subject();
2016-11-24 01:50:57 +03:00
model.set('label', '');
model.set('url', 'test');
2016-11-24 01:50:57 +03:00
expect(model.get('isComplete')).to.be.false;
});
2016-11-24 01:50:57 +03:00
it('isComplete is false when url is blank', function () {
let model = this.subject();
2016-11-24 01:50:57 +03:00
model.set('label', 'test');
model.set('url', '');
2016-11-24 01:50:57 +03:00
expect(model.get('isComplete')).to.be.false;
});
2016-11-24 01:50:57 +03:00
it('isBlank is true when label and url are blank', function () {
let model = this.subject();
2016-11-24 01:50:57 +03:00
model.set('label', '');
model.set('url', '');
2016-11-24 01:50:57 +03:00
expect(model.get('isBlank')).to.be.true;
});
2016-11-24 01:50:57 +03:00
it('isBlank is false when label is present', function () {
let model = this.subject();
2016-11-24 01:50:57 +03:00
model.set('label', 'test');
model.set('url', '');
2016-11-24 01:50:57 +03:00
expect(model.get('isBlank')).to.be.false;
});
2016-11-24 01:50:57 +03:00
it('isBlank is false when url is present', function () {
let model = this.subject();
2016-11-24 01:50:57 +03:00
model.set('label', '');
model.set('url', 'test');
expect(model.get('isBlank')).to.be.false;
});
});