FIX: wrong url for default logos in header on subfolder installs

This commit is contained in:
Neil Lalonde 2018-07-13 14:20:24 -04:00
parent b1082924b9
commit 8ceed642cb
2 changed files with 52 additions and 3 deletions

View File

@ -31,7 +31,7 @@ export default createWidget("home-logo", {
if (logoSmallUrl.length) {
return h("img#site-logo.logo-small", {
key: "logo-small",
attributes: { src: logoSmallUrl, width: 33, height: 33, alt: title }
attributes: { src: Discourse.getURL(logoSmallUrl), width: 33, height: 33, alt: title }
});
} else {
return iconNode("home");
@ -39,12 +39,12 @@ export default createWidget("home-logo", {
} else if (showMobileLogo) {
return h("img#site-logo.logo-big", {
key: "logo-mobile",
attributes: { src: mobileLogoUrl, alt: title }
attributes: { src: Discourse.getURL(mobileLogoUrl), alt: title }
});
} else if (logoUrl.length) {
return h("img#site-logo.logo-big", {
key: "logo-big",
attributes: { src: logoUrl, alt: title }
attributes: { src: Discourse.getURL(logoUrl), alt: title }
});
} else {
return h("h1#site-text-logo.text-logo", { key: "logo-text" }, title);

View File

@ -96,3 +96,52 @@ widgetTest("mobile without logo", {
assert.equal(this.$("#site-logo").attr("src"), bigLogo);
}
});
widgetTest("basics, subfolder", {
template: '{{mount-widget widget="home-logo" args=args}}',
beforeEach() {
Discourse.BaseUri = "/forum";
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.$("img#site-logo.logo-big").length === 1);
assert.equal(this.$("#site-logo").attr("src"), `/forum${bigLogo}`);
assert.equal(this.$("#site-logo").attr("alt"), title);
}
});
widgetTest("basics, subfolder - minimized", {
template: '{{mount-widget widget="home-logo" args=args}}',
beforeEach() {
Discourse.BaseUri = "/forum";
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"), `/forum${smallLogo}`);
assert.equal(this.$("img.logo-small").attr("alt"), title);
}
});
widgetTest("mobile logo, subfolder", {
template: '{{mount-widget widget="home-logo" args=args}}',
beforeEach() {
Discourse.BaseUri = "/forum";
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"), `/forum${mobileLogo}`);
}
});