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) {
|
||||
if (prev.attrs.cooked !== this.attrs.cooked) {
|
||||
if ((prev.attrs.cooked !== this.attrs.cooked) ||
|
||||
(prev.attrs.highlightTerm !== this.attrs.highlightTerm)) {
|
||||
|
||||
return this.init();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -64,6 +64,7 @@ const SearchHelper = {
|
|||
}
|
||||
|
||||
searchData.results = content;
|
||||
widget.appEvents.trigger('post-stream:refresh', { force: true });
|
||||
}).finally(() => {
|
||||
searchData.loading = false;
|
||||
widget.scheduleRerender();
|
||||
|
|
|
@ -69,6 +69,11 @@ QUnit.test("Search with context", assert => {
|
|||
|
||||
andThen(() => {
|
||||
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("/");
|
||||
|
|
Loading…
Reference in New Issue