mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
* renames `select-box-kit` into `select-kit`
* introduces `single-select` and `multi-select` as base components
* introduces {{search-advanced-category-chooser}} as a better component for selecting category in advanced search
* improves events handling in select-kit
* recreates color selection inputs using {{multi-select}} and a custom {{selected-color}} component
* replaces category-selector by a component using select-kit and based on multi-select
* improves positioning of wrapper
* removes the need for offscreen, and instead use `select-kit-header` as a base focus point for all select-kit based components
* introduces a formal plugin api for select-kit based components
* introduces a formal pattern for loading and updating select-kit based components:
```
computeValue()
computeContent()
mutateValue()
```
99 lines
2.8 KiB
JavaScript
99 lines
2.8 KiB
JavaScript
import { moduleForWidget, widgetTest } from 'helpers/widget-test';
|
|
|
|
moduleForWidget('home-logo');
|
|
|
|
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";
|
|
|
|
widgetTest('basics', {
|
|
template: '{{mount-widget widget="home-logo" args=args}}',
|
|
beforeEach() {
|
|
this.siteSettings.logo_url = bigLogo;
|
|
this.siteSettings.logo_small_url = smallLogo;
|
|
this.siteSettings.title = title;
|
|
this.set('args', { minimized: false });
|
|
},
|
|
|
|
test(assert) {
|
|
assert.ok(this.$('.title').length === 1);
|
|
|
|
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);
|
|
}
|
|
});
|
|
|
|
widgetTest('basics - minimized', {
|
|
template: '{{mount-widget widget="home-logo" args=args}}',
|
|
beforeEach() {
|
|
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);
|
|
}
|
|
});
|
|
|
|
widgetTest('no logo', {
|
|
template: '{{mount-widget widget="home-logo" args=args}}',
|
|
beforeEach() {
|
|
this.siteSettings.logo_url = '';
|
|
this.siteSettings.logo_small_url = '';
|
|
this.siteSettings.title = title;
|
|
this.set('args', { minimized: false });
|
|
},
|
|
|
|
test(assert) {
|
|
assert.ok(this.$('h2#site-text-logo.text-logo').length === 1);
|
|
assert.equal(this.$('#site-text-logo').text(), title);
|
|
}
|
|
});
|
|
|
|
widgetTest('no logo - minimized', {
|
|
template: '{{mount-widget widget="home-logo" args=args}}',
|
|
beforeEach() {
|
|
this.siteSettings.logo_url = '';
|
|
this.siteSettings.logo_small_url = '';
|
|
this.siteSettings.title = title;
|
|
this.set('args', { minimized: true });
|
|
},
|
|
|
|
test(assert) {
|
|
assert.ok(this.$('.d-home').length === 1);
|
|
}
|
|
});
|
|
|
|
widgetTest('mobile logo', {
|
|
template: '{{mount-widget widget="home-logo" args=args}}',
|
|
beforeEach() {
|
|
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);
|
|
}
|
|
});
|
|
|
|
widgetTest('mobile without logo', {
|
|
template: '{{mount-widget widget="home-logo" args=args}}',
|
|
beforeEach() {
|
|
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);
|
|
}
|
|
});
|