tests:
plain_text:
- description: "Highlight the beginning of a string"
text: "this is a test"
hits: [ [0, 4] ]
expected: "this is a test"
- description: "Highlight the middle of a string"
text: "this is a test"
hits: [ [5, 7] ]
expected: "this is a test"
- description: "Highlight the end of a string"
text: "this is a test"
hits: [ [10, 14] ]
expected: "this is a test"
- description: "Highlight multiple terms"
text: "this is a test"
hits: [ [0, 4], [10, 14] ]
expected: "this is a test"
- description: "DO NOT highlight with empty hits"
text: "this is a test"
hits: []
expected: "this is a test"
- description: "Highlight within Japanese text"
text: "東京の天気"
hits: [ [0, 2] ]
expected: "東京の天気"
with_links:
- description: "Highlight after a link (offset does not include markup)"
text: "@username this is an example"
hits: [ [10, 14] ]
expected: "@username this is an example"
- description: "Highlight anchor text of a link (offset does not include markup)"
text: "@username this is an example"
hits: [ [1, 9] ]
expected: "@username this is an example"
- description: "Highlight around a link (offset does not include markup)"
text: "@username this is an example"
hits: [ [0, 14] ]
expected: "@username this is an example"
- description: "Highlight touching tags"
text: "foofoo"
hits: [ [3, 6] ]
expected: "foofoo"
- description: "Highlight two links"
text: "foo bar baz"
hits: [ [4, 7], [8, 11] ]
expected: "foo bar baz"
- description: "Highlight non-link then link not at end"
text: "foo bar baz something else"
hits: [ [4, 7], [8, 11] ]
expected: "foo bar baz something else"
- description: "Highlight non-link then link at end"
text: "foo bar baz"
hits: [ [4, 7], [8, 11] ]
expected: "foo bar baz"
- description: "Highlight mention at end"
text: "something via @twitter"
hits: [ [14, 22] ]
expected: "something via @twitter"