diff --git a/assets/javascripts/discourse/connectors/above-main-container/jt-lines-fallback.gts b/assets/javascripts/discourse/connectors/above-main-container/jt-lines-fallback.gts index 15296905..cf29ddf8 100644 --- a/assets/javascripts/discourse/connectors/above-main-container/jt-lines-fallback.gts +++ b/assets/javascripts/discourse/connectors/above-main-container/jt-lines-fallback.gts @@ -55,7 +55,8 @@ export default class JtLinesFallback extends Component { this.host.className = this.hostClass; this.#root = this.host.attachShadow({ mode: "closed" }); this.#root.adoptedStyleSheets = [sheet()]; - this.#sprite.setAttribute("hidden", ""); + // hidden takes no effect on an svg: it would hold 300×150 of room + this.#sprite.style.display = "none"; this.inner.className = "jt-lines"; this.#root.append(this.#sprite, this.inner); } diff --git a/spec/system/ads_spec.rb b/spec/system/ads_spec.rb index 812b9393..2d09c4f8 100644 --- a/spec/system/ads_spec.rb +++ b/spec/system/ads_spec.rb @@ -149,6 +149,13 @@ def hide_space "Spring sale", ) end + + # the fallback is the card's size, nothing more + sizes = + page.evaluate_script( + "[#{host}, #{fallback}.querySelector('.jt-lines')].map((el) => el.getBoundingClientRect().height)", + ) + expect(sizes[0]).to be_within(1).of(sizes[1]) end # Nothing outside the root a page rule could name, and a script that