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