FIX: Remote themes Github link should go to custom branch #9184

This commit is contained in:
Vinoth Kannan
2020-03-18 03:57:54 +05:30
parent 0b2e6f4301
commit 48d690ae01
4 changed files with 62 additions and 2 deletions
@@ -0,0 +1,49 @@
import { mapRoutes } from "discourse/mapping-router";
import Theme from "admin/models/theme";
moduleFor("controller:admin-customize-themes-show", {
beforeEach() {
this.registry.register("router:main", mapRoutes());
},
needs: ["controller:adminUser"]
});
const repoUrl = "https://github.com/discourse/discourse-brand-header.git";
const remoteTheme = Theme.create({
id: 2,
default: true,
name: "default",
remote_theme: {
remote_url: repoUrl
}
});
QUnit.test("can display source url for remote themes", function(assert) {
const controller = this.subject({
model: remoteTheme
});
assert.deepEqual(
controller.get("remoteThemeLink"),
repoUrl,
"returns theme's repo URL"
);
});
QUnit.test("can display source url for remote theme branches", function(
assert
) {
const branchUrl =
"https://github.com/discourse/discourse-brand-header/tree/beta";
remoteTheme["remote_theme"]["branch"] = "beta";
const controller = this.subject({
model: remoteTheme
});
assert.deepEqual(
controller.get("remoteThemeLink"),
branchUrl,
"returns theme's repo URL to branch"
);
});