Style Polaris model cards by series

This commit is contained in:
Dom
2026-11-03 12:06:50 -06:00
parent b302c2ef8f
commit fc45eb6862
2 changed files with 16 additions and 2 deletions
@@ -320,9 +320,18 @@ assert.equal(modelActionAllowed({ ...refreshingCatalog, randomizer: true }, "sel
assert.equal(modelActionAllowed({ ...refreshingCatalog, refreshing: false }, "select-big", big), false)
assert.equal(modelActionAllowed(refreshingCatalog, "delete", small), false)
for (const series of ["Polaris", "Polaris Series", " POLARIS SERIES "]) {
for (const value of ["spz_polaris_r3a", "future-model", undefined]) assert.equal(ModelsPage.methods.isPolaris({value, series}), true)
}
for (const series of ["OP Series", "SP Series", "Polaris Experimental", "", undefined, null, 123]) {
assert.equal(ModelsPage.methods.isPolaris({value: "unrelated", label: "Polaris", series}), false)
}
for (const value of ["spz_polaris_r3a", "spz_polaris_r3b"]) assert.equal(ModelsPage.methods.isPolaris({value}), true)
for (const value of ["polaris", "spz_polaris_r3a_copy", "lightspeed", undefined]) assert.equal(ModelsPage.methods.isPolaris({value, label: "Polaris"}), false)
assert.equal(ModelsPage.methods.isPolaris({value: "spz_polaris_r3a_copy"}), false)
assert.equal(ModelsPage.methods.isPolaris(null), false)
assert.match(ModelsPage.template, /gx-model-card--polaris.*isPolaris\(m\)/)
assert.match(ModelsPage.template, /v-if="isPolaris\(m\)" class="gx-chip gx-polaris-badge"/)
assert.match(ModelsPage.template, /aria-label="About Polaris models"/)
for (const label of ["Polaris R3 A ⚠️🧪", "Polaris R3 B ⚠️🧪", "Polaris R3 A", "Polaris R3 B 🚀"]) {
const [text, emojis] = ModelsPage.methods.polarisTitleParts({label})
@@ -330,3 +339,4 @@ for (const label of ["Polaris R3 A ⚠️🧪", "Polaris R3 B ⚠️🧪", "Pola
assert.equal(/\p{Extended_Pictographic}/u.test(text), false)
}
assert.deepEqual(ModelsPage.methods.polarisTitleParts({value: "spz_polaris_r3a"}), ["spz_polaris_r3a", ""])
+5 -1
View File
@@ -392,7 +392,10 @@ export const ModelsPage = {
this.manager.stop()
},
methods: {
isPolaris(model) { return ["spz_polaris_r3a", "spz_polaris_r3b"].includes(model?.value) },
isPolaris(model) {
const series = typeof model?.series === "string" ? model.series.trim().toLowerCase() : ""
return series === "polaris" || series === "polaris series" || ["spz_polaris_r3a", "spz_polaris_r3b"].includes(model?.value)
},
polarisTitleParts(model) {
const label = model.label || model.value
const emoji = label.search(/\p{Extended_Pictographic}/u)
@@ -640,3 +643,4 @@ export const ModelsPage = {
</div>
`,
}