Skip to content

Commit f40171c

Browse files
authored
Merge pull request #2 from navikt/fix-typo
fix: 🐛 typo in rule name
2 parents 951ae96 + 04565b4 commit f40171c

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

src/rules.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ function escapeRegExp(text: string): string {
5656
return text.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, '\\$&');
5757
}
5858

59-
export function createDynamicHighligtingRule(query: string[]): Rule {
59+
export function createDynamicHighlightingRule(query: string[]): Rule {
6060
const queryPattern = query
6161
.filter(word => word.length > 0)
6262
.map(escapeRegExp)
@@ -117,4 +117,4 @@ export const LinkRule: Rule = {
117117
props: { href, target: '_blank', rel: 'noopener' }
118118
};
119119
}
120-
};
120+
};

test/rules.test.ts

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import {
22
ASTNode,
33
BoldRule,
4-
createDynamicHighligtingRule,
4+
createDynamicHighlightingRule,
55
HighlightRule,
66
LinebreakRule,
77
LinkRule,
@@ -105,7 +105,7 @@ describe('rules', () => {
105105

106106
describe('dynamicHighlight', () => {
107107
it('should have basic config', () => {
108-
const rule = createDynamicHighligtingRule([]);
108+
const rule = createDynamicHighlightingRule([]);
109109
expect(rule.name).toBe('DynamicHighlight');
110110
expect(rule.scope).toBe(RuleScope.INLINE);
111111
expect(rule.parse({...matched, capture: ['Content here']})).toEqual({
@@ -123,11 +123,11 @@ describe('rules', () => {
123123
.split('')
124124
.map((token) => `\\${token}`)
125125
.join('');
126-
expect(createDynamicHighligtingRule([scaryTokenlist]).regex.toString()).toContain(safeTokenlist);
126+
expect(createDynamicHighlightingRule([scaryTokenlist]).regex.toString()).toContain(safeTokenlist);
127127
});
128128

129129
it('it should use word-boundries to highlight', () => {
130-
expect(match(createDynamicHighligtingRule(['ll']).regex, 'good hello world')).toMatchObject({
130+
expect(match(createDynamicHighlightingRule(['ll']).regex, 'good hello world')).toMatchObject({
131131
fullmatch: 'hello',
132132
capture: ['hello']
133133
});
@@ -234,4 +234,4 @@ describe('rules', () => {
234234
expect(match(LinkRule.regex, 'data domain.com data')).toBeNull();
235235
});
236236
});
237-
});
237+
});

0 commit comments

Comments
 (0)