2016-04-14 15:23:05 -04:00
|
|
|
import { moduleForWidget, widgetTest } from 'helpers/widget-test';
|
2016-03-21 14:16:05 -04:00
|
|
|
|
2016-04-14 15:23:05 -04:00
|
|
|
moduleForWidget('home-logo');
|
2016-03-21 14:16:05 -04:00
|
|
|
|
|
|
|
const bigLogo = '/images/d-logo-sketch.png?test';
|
|
|
|
const smallLogo = '/images/d-logo-sketch-small.png?test';
|
|
|
|
const mobileLogo = '/images/d-logo-sketch.png?mobile';
|
|
|
|
const title = "Cool Forum";
|
|
|
|
|
2016-04-14 15:23:05 -04:00
|
|
|
widgetTest('basics', {
|
|
|
|
template: '{{mount-widget widget="home-logo" args=args}}',
|
2017-06-14 13:57:58 -04:00
|
|
|
beforeEach() {
|
2016-03-21 14:16:05 -04:00
|
|
|
this.siteSettings.logo_url = bigLogo;
|
2017-05-02 16:02:00 -04:00
|
|
|
this.siteSettings.logo_small_url = smallLogo;
|
2016-03-21 14:16:05 -04:00
|
|
|
this.siteSettings.title = title;
|
2016-04-14 15:23:05 -04:00
|
|
|
this.set('args', { minimized: false });
|
2016-03-21 14:16:05 -04:00
|
|
|
},
|
|
|
|
|
|
|
|
test(assert) {
|
2016-03-21 15:14:16 -04:00
|
|
|
assert.ok(this.$('.title').length === 1);
|
2016-03-21 14:16:05 -04:00
|
|
|
|
|
|
|
assert.ok(this.$('img#site-logo.logo-big').length === 1);
|
|
|
|
assert.equal(this.$('#site-logo').attr('src'), bigLogo);
|
|
|
|
assert.equal(this.$('#site-logo').attr('alt'), title);
|
2016-04-14 15:23:05 -04:00
|
|
|
}
|
|
|
|
});
|
2016-03-21 14:16:05 -04:00
|
|
|
|
2017-05-01 11:34:01 -04:00
|
|
|
widgetTest('basics - minimized', {
|
2016-04-14 15:23:05 -04:00
|
|
|
template: '{{mount-widget widget="home-logo" args=args}}',
|
2017-06-14 13:57:58 -04:00
|
|
|
beforeEach() {
|
2016-04-14 15:23:05 -04:00
|
|
|
this.siteSettings.logo_url = bigLogo;
|
|
|
|
this.siteSettings.logo_small_url= smallLogo;
|
|
|
|
this.siteSettings.title = title;
|
|
|
|
this.set('args', { minimized: true });
|
|
|
|
},
|
|
|
|
|
|
|
|
test(assert) {
|
|
|
|
assert.ok(this.$('img.logo-small').length === 1);
|
|
|
|
assert.equal(this.$('img.logo-small').attr('src'), smallLogo);
|
|
|
|
assert.equal(this.$('img.logo-small').attr('alt'), title);
|
2016-03-21 14:16:05 -04:00
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2016-04-14 15:23:05 -04:00
|
|
|
widgetTest('no logo', {
|
|
|
|
template: '{{mount-widget widget="home-logo" args=args}}',
|
2017-06-14 13:57:58 -04:00
|
|
|
beforeEach() {
|
2016-03-21 14:16:05 -04:00
|
|
|
this.siteSettings.logo_url = '';
|
|
|
|
this.siteSettings.logo_small_url = '';
|
|
|
|
this.siteSettings.title = title;
|
2016-04-14 15:23:05 -04:00
|
|
|
this.set('args', { minimized: false });
|
2016-03-21 14:16:05 -04:00
|
|
|
},
|
|
|
|
|
|
|
|
test(assert) {
|
|
|
|
assert.ok(this.$('h2#site-text-logo.text-logo').length === 1);
|
|
|
|
assert.equal(this.$('#site-text-logo').text(), title);
|
2016-04-14 15:23:05 -04:00
|
|
|
}
|
|
|
|
});
|
2016-03-21 14:16:05 -04:00
|
|
|
|
2016-04-14 15:23:05 -04:00
|
|
|
widgetTest('no logo - minimized', {
|
|
|
|
template: '{{mount-widget widget="home-logo" args=args}}',
|
2017-06-14 13:57:58 -04:00
|
|
|
beforeEach() {
|
2016-04-14 15:23:05 -04:00
|
|
|
this.siteSettings.logo_url = '';
|
|
|
|
this.siteSettings.logo_small_url = '';
|
|
|
|
this.siteSettings.title = title;
|
|
|
|
this.set('args', { minimized: true });
|
|
|
|
},
|
|
|
|
|
|
|
|
test(assert) {
|
2017-11-21 05:53:09 -05:00
|
|
|
assert.ok(this.$('.d-home').length === 1);
|
2016-03-21 14:16:05 -04:00
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2016-04-14 15:23:05 -04:00
|
|
|
widgetTest('mobile logo', {
|
|
|
|
template: '{{mount-widget widget="home-logo" args=args}}',
|
2017-06-14 13:57:58 -04:00
|
|
|
beforeEach() {
|
2016-03-21 14:16:05 -04:00
|
|
|
this.siteSettings.mobile_logo_url = mobileLogo;
|
|
|
|
this.siteSettings.logo_small_url= smallLogo;
|
|
|
|
this.site.mobileView = true;
|
|
|
|
},
|
|
|
|
|
|
|
|
test(assert) {
|
|
|
|
assert.ok(this.$('img#site-logo.logo-big').length === 1);
|
|
|
|
assert.equal(this.$('#site-logo').attr('src'), mobileLogo);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2016-04-14 15:23:05 -04:00
|
|
|
widgetTest('mobile without logo', {
|
|
|
|
template: '{{mount-widget widget="home-logo" args=args}}',
|
2017-06-14 13:57:58 -04:00
|
|
|
beforeEach() {
|
2016-03-21 14:16:05 -04:00
|
|
|
this.siteSettings.logo_url = bigLogo;
|
|
|
|
this.site.mobileView = true;
|
|
|
|
},
|
|
|
|
|
|
|
|
test(assert) {
|
|
|
|
assert.ok(this.$('img#site-logo.logo-big').length === 1);
|
|
|
|
assert.equal(this.$('#site-logo').attr('src'), bigLogo);
|
|
|
|
}
|
|
|
|
});
|