mirror of
https://github.com/discourse/discourse.git
synced 2025-02-24 01:20:55 +08:00

jquery.autoellipsis tries to automatically find the available space which depends on multiple factors which may differ between the machines where the tests are running. Follow-up to commit 9c628f089792dbbc417a185c5933d6cbcd54dd31.
33 lines
892 B
JavaScript
33 lines
892 B
JavaScript
import componentTest from "helpers/component-test";
|
|
|
|
moduleForComponent("text-overflow", { integration: true });
|
|
|
|
componentTest("default", {
|
|
template: `
|
|
<style>
|
|
.overflow {
|
|
max-height: 40px;
|
|
overflow: hidden;
|
|
width: 500px;
|
|
}
|
|
</style>
|
|
|
|
<div>{{text-overflow class='overflow' text=text}}</div>`,
|
|
|
|
beforeEach() {
|
|
this.set(
|
|
"text",
|
|
"Lorem ipsum dolor sit amet, consectetur adipiscing elit.\nFusce convallis faucibus tortor quis vestibulum.<br>\nPhasellus pharetra dolor eget imperdiet tempor.<br>\nQuisque hendrerit magna id consectetur rutrum.<br>\nNulla vel tortor leo.<br>\nFusce ullamcorper lacus quis sodales ornare.<br>"
|
|
);
|
|
},
|
|
|
|
test(assert) {
|
|
const text = find(".overflow")
|
|
.text()
|
|
.trim();
|
|
|
|
assert.ok(text.startsWith("Lorem ipsum dolor sit amet"));
|
|
assert.ok(text.endsWith("..."));
|
|
}
|
|
});
|