diff --git a/app/assets/javascripts/discourse/components/text-overflow.js.es6 b/app/assets/javascripts/discourse/components/text-overflow.js.es6 index d5bc066fb0..90a9cc21a2 100644 --- a/app/assets/javascripts/discourse/components/text-overflow.js.es6 +++ b/app/assets/javascripts/discourse/components/text-overflow.js.es6 @@ -7,6 +7,7 @@ export default Component.extend({ const $this = $(this.element); if ($this) { + $this.find("br").replaceWith(" "); $this.find("hr").remove(); $this.ellipsis(); } diff --git a/test/javascripts/components/text-overflow-test.js.es6 b/test/javascripts/components/text-overflow-test.js.es6 new file mode 100644 index 0000000000..dac6d6352c --- /dev/null +++ b/test/javascripts/components/text-overflow-test.js.es6 @@ -0,0 +1,32 @@ +import componentTest from "helpers/component-test"; + +moduleForComponent("text-overflow", { integration: true }); + +componentTest("default", { + template: ` + + +
{{text-overflow class='overflow' text=text}}
`, + + beforeEach() { + this.set( + "text", + "Lorem ipsum dolor sit amet, consectetur adipiscing elit.\nFusce convallis faucibus tortor quis vestibulum.
\nPhasellus pharetra dolor eget imperdiet tempor.
\nQuisque hendrerit magna id consectetur rutrum.
\nNulla vel tortor leo.
\nFusce ullamcorper lacus quis sodales ornare.
" + ); + }, + + test(assert) { + assert.equal( + find(".overflow") + .text() + .trim(), + "Lorem ipsum dolor sit amet, consectetur adipiscing elit.\nFusce convallis faucibus tortor quis vestibulum. Phasellus pharetra dolor eget imperdiet..." + ); + } +});