mirror of
https://github.com/discourse/discourse.git
synced 2025-02-21 22:48:55 +08:00
FIX: Search term scoped to topic should be highlighted in widget dom era.
https://meta.discourse.org/t/highlight-the-search-results/10322/4?u=tgxworld
This commit is contained in:
parent
ad833c4485
commit
32147d4ff9
@ -20,7 +20,9 @@ export default class PostCooked {
|
|||||||
}
|
}
|
||||||
|
|
||||||
update(prev) {
|
update(prev) {
|
||||||
if (prev.attrs.cooked !== this.attrs.cooked) {
|
if ((prev.attrs.cooked !== this.attrs.cooked) ||
|
||||||
|
(prev.attrs.highlightTerm !== this.attrs.highlightTerm)) {
|
||||||
|
|
||||||
return this.init();
|
return this.init();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -64,6 +64,7 @@ const SearchHelper = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
searchData.results = content;
|
searchData.results = content;
|
||||||
|
widget.appEvents.trigger('post-stream:refresh', { force: true });
|
||||||
}).finally(() => {
|
}).finally(() => {
|
||||||
searchData.loading = false;
|
searchData.loading = false;
|
||||||
widget.scheduleRerender();
|
widget.scheduleRerender();
|
||||||
|
@ -69,6 +69,11 @@ QUnit.test("Search with context", assert => {
|
|||||||
|
|
||||||
andThen(() => {
|
andThen(() => {
|
||||||
assert.ok(exists('.search-menu .results ul li'), 'it shows results');
|
assert.ok(exists('.search-menu .results ul li'), 'it shows results');
|
||||||
|
|
||||||
|
assert.ok(
|
||||||
|
exists('.cooked span.highlight-strong'),
|
||||||
|
'it should highlight the search term'
|
||||||
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
visit("/");
|
visit("/");
|
||||||
|
Loading…
x
Reference in New Issue
Block a user