2016-11-24 01:50:57 +03:00
|
|
|
import {describe, it} from 'mocha';
|
|
|
|
import {setupComponentTest} from 'ember-mocha';
|
2015-02-18 23:02:48 +03:00
|
|
|
|
2016-11-24 01:50:57 +03:00
|
|
|
describe('Unit: Component: gh-url-preview', function () {
|
|
|
|
setupComponentTest('gh-url-preview', {
|
|
|
|
unit: true
|
|
|
|
});
|
2015-02-18 23:02:48 +03:00
|
|
|
|
2016-11-24 01:50:57 +03:00
|
|
|
it('generates the correct preview URL with a prefix', function () {
|
|
|
|
let component = this.subject({
|
|
|
|
prefix: 'tag',
|
|
|
|
slug: 'test-slug',
|
|
|
|
tagName: 'p',
|
|
|
|
classNames: 'test-class',
|
2015-02-18 23:02:48 +03:00
|
|
|
|
2016-11-24 01:50:57 +03:00
|
|
|
config: {blogUrl: 'http://my-ghost-blog.com'}
|
2015-02-18 23:02:48 +03:00
|
|
|
});
|
|
|
|
|
2016-11-24 01:50:57 +03:00
|
|
|
this.render();
|
2015-02-18 23:02:48 +03:00
|
|
|
|
2016-11-24 01:50:57 +03:00
|
|
|
expect(component.get('url')).to.equal('my-ghost-blog.com/tag/test-slug/');
|
|
|
|
});
|
2015-02-18 23:02:48 +03:00
|
|
|
|
2016-11-24 01:50:57 +03:00
|
|
|
it('generates the correct preview URL without a prefix', function () {
|
|
|
|
let component = this.subject({
|
|
|
|
slug: 'test-slug',
|
|
|
|
tagName: 'p',
|
|
|
|
classNames: 'test-class',
|
2015-02-18 23:02:48 +03:00
|
|
|
|
2016-11-24 01:50:57 +03:00
|
|
|
config: {blogUrl: 'http://my-ghost-blog.com'}
|
2015-02-18 23:02:48 +03:00
|
|
|
});
|
2016-11-24 01:50:57 +03:00
|
|
|
|
|
|
|
this.render();
|
|
|
|
|
|
|
|
expect(component.get('url')).to.equal('my-ghost-blog.com/test-slug/');
|
|
|
|
});
|
|
|
|
});
|