2018-06-15 11:03:24 -04:00
|
|
|
import { moduleForWidget, widgetTest } from "helpers/widget-test";
|
2016-03-21 14:16:05 -04:00
|
|
|
|
2018-06-15 11:03:24 -04:00
|
|
|
moduleForWidget("home-logo");
|
2016-03-21 14:16:05 -04:00
|
|
|
|
2018-06-15 11:03:24 -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";
|
2016-03-21 14:16:05 -04:00
|
|
|
const title = "Cool Forum";
|
|
|
|
|
2018-06-15 11:03:24 -04:00
|
|
|
widgetTest("basics", {
|
2016-04-14 15:23:05 -04:00
|
|
|
template: '{{mount-widget widget="home-logo" args=args}}',
|
2019-05-16 14:15:37 -04:00
|
|
|
skip: true,
|
2017-06-14 13:57:58 -04:00
|
|
|
beforeEach() {
|
2019-01-02 02:29:17 -05:00
|
|
|
this.siteSettings.site_logo_url = bigLogo;
|
2018-11-14 02:03:02 -05:00
|
|
|
this.siteSettings.site_logo_small_url = smallLogo;
|
2016-03-21 14:16:05 -04:00
|
|
|
this.siteSettings.title = title;
|
2018-06-15 11:03:24 -04:00
|
|
|
this.set("args", { minimized: false });
|
2016-03-21 14:16:05 -04:00
|
|
|
},
|
|
|
|
|
|
|
|
test(assert) {
|
2019-02-25 10:04:55 -05:00
|
|
|
assert.ok(find(".title").length === 1);
|
2016-03-21 14:16:05 -04:00
|
|
|
|
2019-02-25 10:04:55 -05:00
|
|
|
assert.ok(find("img#site-logo.logo-big").length === 1);
|
|
|
|
assert.equal(find("#site-logo").attr("src"), bigLogo);
|
|
|
|
assert.equal(find("#site-logo").attr("alt"), title);
|
2016-04-14 15:23:05 -04:00
|
|
|
}
|
|
|
|
});
|
2016-03-21 14:16:05 -04:00
|
|
|
|
2018-06-15 11:03:24 -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() {
|
2019-01-02 02:29:17 -05:00
|
|
|
this.siteSettings.site_logo_url = bigLogo;
|
2018-11-14 02:03:02 -05:00
|
|
|
this.siteSettings.site_logo_small_url = smallLogo;
|
2016-04-14 15:23:05 -04:00
|
|
|
this.siteSettings.title = title;
|
2018-06-15 11:03:24 -04:00
|
|
|
this.set("args", { minimized: true });
|
2016-04-14 15:23:05 -04:00
|
|
|
},
|
|
|
|
|
|
|
|
test(assert) {
|
2019-02-25 10:04:55 -05:00
|
|
|
assert.ok(find("img.logo-small").length === 1);
|
|
|
|
assert.equal(find("img.logo-small").attr("src"), smallLogo);
|
|
|
|
assert.equal(find("img.logo-small").attr("alt"), title);
|
2016-03-21 14:16:05 -04:00
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2018-06-15 11:03:24 -04:00
|
|
|
widgetTest("no logo", {
|
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() {
|
2019-01-02 02:29:17 -05:00
|
|
|
this.siteSettings.site_logo_url = "";
|
2018-11-14 02:03:02 -05:00
|
|
|
this.siteSettings.site_logo_small_url = "";
|
2016-03-21 14:16:05 -04:00
|
|
|
this.siteSettings.title = title;
|
2018-06-15 11:03:24 -04:00
|
|
|
this.set("args", { minimized: false });
|
2016-03-21 14:16:05 -04:00
|
|
|
},
|
|
|
|
|
|
|
|
test(assert) {
|
2019-02-25 10:04:55 -05:00
|
|
|
assert.ok(find("h1#site-text-logo.text-logo").length === 1);
|
|
|
|
assert.equal(find("#site-text-logo").text(), title);
|
2016-04-14 15:23:05 -04:00
|
|
|
}
|
|
|
|
});
|
2016-03-21 14:16:05 -04:00
|
|
|
|
2018-06-15 11:03:24 -04:00
|
|
|
widgetTest("no logo - 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() {
|
2019-01-02 02:29:17 -05:00
|
|
|
this.siteSettings.site_logo_url = "";
|
2018-11-14 02:03:02 -05:00
|
|
|
this.siteSettings.site_logo_small_url = "";
|
2016-04-14 15:23:05 -04:00
|
|
|
this.siteSettings.title = title;
|
2018-06-15 11:03:24 -04:00
|
|
|
this.set("args", { minimized: true });
|
2016-04-14 15:23:05 -04:00
|
|
|
},
|
|
|
|
|
|
|
|
test(assert) {
|
2019-02-25 10:04:55 -05:00
|
|
|
assert.ok(find(".d-icon-home").length === 1);
|
2016-03-21 14:16:05 -04:00
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2018-06-15 11:03:24 -04:00
|
|
|
widgetTest("mobile logo", {
|
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() {
|
2018-11-14 02:03:02 -05:00
|
|
|
this.siteSettings.site_mobile_logo_url = mobileLogo;
|
|
|
|
this.siteSettings.site_logo_small_url = smallLogo;
|
2016-03-21 14:16:05 -04:00
|
|
|
this.site.mobileView = true;
|
|
|
|
},
|
|
|
|
|
|
|
|
test(assert) {
|
2019-02-25 10:04:55 -05:00
|
|
|
assert.ok(find("img#site-logo.logo-big").length === 1);
|
|
|
|
assert.equal(find("#site-logo").attr("src"), mobileLogo);
|
2016-03-21 14:16:05 -04:00
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2018-06-15 11:03:24 -04:00
|
|
|
widgetTest("mobile without logo", {
|
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() {
|
2019-01-02 02:29:17 -05:00
|
|
|
this.siteSettings.site_logo_url = bigLogo;
|
2016-03-21 14:16:05 -04:00
|
|
|
this.site.mobileView = true;
|
|
|
|
},
|
|
|
|
|
|
|
|
test(assert) {
|
2019-02-25 10:04:55 -05:00
|
|
|
assert.ok(find("img#site-logo.logo-big").length === 1);
|
|
|
|
assert.equal(find("#site-logo").attr("src"), bigLogo);
|
2016-03-21 14:16:05 -04:00
|
|
|
}
|
|
|
|
});
|
2018-07-13 14:20:24 -04:00
|
|
|
|
|
|
|
widgetTest("basics, subfolder", {
|
|
|
|
template: '{{mount-widget widget="home-logo" args=args}}',
|
|
|
|
beforeEach() {
|
|
|
|
Discourse.BaseUri = "/forum";
|
2019-01-02 02:29:17 -05:00
|
|
|
this.siteSettings.site_logo_url = bigLogo;
|
2018-11-14 02:03:02 -05:00
|
|
|
this.siteSettings.site_logo_small_url = smallLogo;
|
2018-07-13 14:20:24 -04:00
|
|
|
this.siteSettings.title = title;
|
|
|
|
this.set("args", { minimized: false });
|
|
|
|
},
|
|
|
|
|
|
|
|
test(assert) {
|
2019-02-25 10:04:55 -05:00
|
|
|
assert.ok(find("img#site-logo.logo-big").length === 1);
|
|
|
|
assert.equal(find("#site-logo").attr("src"), `/forum${bigLogo}`);
|
|
|
|
assert.equal(find("#site-logo").attr("alt"), title);
|
2018-07-13 14:20:24 -04:00
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
widgetTest("basics, subfolder - minimized", {
|
|
|
|
template: '{{mount-widget widget="home-logo" args=args}}',
|
|
|
|
beforeEach() {
|
|
|
|
Discourse.BaseUri = "/forum";
|
2019-01-02 02:29:17 -05:00
|
|
|
this.siteSettings.site_logo_url = bigLogo;
|
2018-11-14 02:03:02 -05:00
|
|
|
this.siteSettings.site_logo_small_url = smallLogo;
|
2018-07-13 14:20:24 -04:00
|
|
|
this.siteSettings.title = title;
|
|
|
|
this.set("args", { minimized: true });
|
|
|
|
},
|
|
|
|
|
|
|
|
test(assert) {
|
2019-02-25 10:04:55 -05:00
|
|
|
assert.ok(find("img.logo-small").length === 1);
|
|
|
|
assert.equal(find("img.logo-small").attr("src"), `/forum${smallLogo}`);
|
|
|
|
assert.equal(find("img.logo-small").attr("alt"), title);
|
2018-07-13 14:20:24 -04:00
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
widgetTest("mobile logo, subfolder", {
|
|
|
|
template: '{{mount-widget widget="home-logo" args=args}}',
|
|
|
|
beforeEach() {
|
|
|
|
Discourse.BaseUri = "/forum";
|
2018-11-14 02:03:02 -05:00
|
|
|
this.siteSettings.site_mobile_logo_url = mobileLogo;
|
|
|
|
this.siteSettings.site_logo_small_url = smallLogo;
|
2018-07-13 14:20:24 -04:00
|
|
|
this.site.mobileView = true;
|
|
|
|
},
|
|
|
|
|
|
|
|
test(assert) {
|
2019-02-25 10:04:55 -05:00
|
|
|
assert.ok(find("img#site-logo.logo-big").length === 1);
|
|
|
|
assert.equal(find("#site-logo").attr("src"), `/forum${mobileLogo}`);
|
2018-07-13 14:20:24 -04:00
|
|
|
}
|
|
|
|
});
|