2016-11-24 01:50:57 +03:00
|
|
|
import {describe, it} from 'mocha';
|
2017-05-29 21:50:03 +03:00
|
|
|
import {expect} from 'chai';
|
2016-11-24 01:50:57 +03:00
|
|
|
import {setupTest} from 'ember-mocha';
|
2016-04-26 12:45:59 +03:00
|
|
|
|
2018-01-05 18:38:23 +03:00
|
|
|
describe('Unit: Model: navigation-item', function () {
|
2019-05-13 15:43:53 +03:00
|
|
|
setupTest();
|
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 () {
|
2019-05-13 15:43:53 +03:00
|
|
|
let model = this.owner.lookup('model:navigation-item');
|
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 () {
|
2019-05-13 15:43:53 +03:00
|
|
|
let model = this.owner.lookup('model:navigation-item');
|
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 () {
|
2019-05-13 15:43:53 +03:00
|
|
|
let model = this.owner.lookup('model:navigation-item');
|
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 () {
|
2019-05-13 15:43:53 +03:00
|
|
|
let model = this.owner.lookup('model:navigation-item');
|
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 () {
|
2019-05-13 15:43:53 +03:00
|
|
|
let model = this.owner.lookup('model:navigation-item');
|
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 () {
|
2019-05-13 15:43:53 +03:00
|
|
|
let model = this.owner.lookup('model:navigation-item');
|
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;
|
|
|
|
});
|
|
|
|
});
|