Skip to content
This repository has been archived by the owner on Dec 30, 2022. It is now read-only.

Commit

Permalink
fix(Snippet): switch tag replacement to mark (#729)
Browse files Browse the repository at this point in the history
Fixes #727
  • Loading branch information
samouss authored Oct 4, 2019
1 parent e3c1ef6 commit 7f30331
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
5 changes: 3 additions & 2 deletions src/components/Snippet.vue
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,13 @@ export default {
'See https://www.algolia.com/doc/api-reference/api-parameters/attributesToSnippet/.'
);
}
return attributeValue
.replace(
new RegExp('<em>', 'g'),
new RegExp('<mark>', 'g'),
`<${this.highlightedTagName} class="${this.suit('highlighted')}">`
)
.replace(new RegExp('</em>', 'g'), `</${this.highlightedTagName}>`);
.replace(new RegExp('</mark>', 'g'), `</${this.highlightedTagName}>`);
},
},
};
Expand Down
6 changes: 3 additions & 3 deletions src/components/__tests__/Snippet.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ test('renders proper HTML', () => {
const hit = {
_snippetResult: {
attr: {
value: `con<em>ten</em>t`,
value: `con<mark>ten</mark>t`,
},
},
};
Expand All @@ -28,7 +28,7 @@ test('renders proper HTML with highlightTagName', () => {
const hit = {
_snippetResult: {
attr: {
value: `con<em>ten</em>t`,
value: `con<mark>ten</mark>t`,
},
},
};
Expand Down Expand Up @@ -83,7 +83,7 @@ test('allows usage of dot delimited path to access nested attribute', () => {
_snippetResult: {
attr: {
nested: {
value: `nested <em>val</em>`,
value: `nested <mark>val</mark>`,
},
},
},
Expand Down

0 comments on commit 7f30331

Please sign in to comment.