Skip to content

Commit

Permalink
Fixed mir3z#3
Browse files Browse the repository at this point in the history
  • Loading branch information
mirz committed Jan 1, 2014
2 parents 1a54b6f + 5440eb4 commit 19169bb
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/jquery.textHighlighter.js
Original file line number Diff line number Diff line change
Expand Up @@ -412,7 +412,7 @@

hlDescriptors.push([
wrapper,
highlight.innerText,
$(highlight).text(),
hlPath.join(':'),
offset,
length
Expand Down
2 changes: 1 addition & 1 deletion src/jquery.textHighlighter.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion src/jquery.textHighlighter.pack.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions test/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -1062,14 +1062,18 @@ $(document).ready(function() {
var hl = $sandbox.getHighlighter();
var highlights = hl.getAllHighlights($sandbox);
var jsonStr = hl.serializeHighlights();
var json = JSON.parse(jsonStr);
var expectedHtml = $sandbox.html();

$sandbox.html(params.sandboxInitHtml);
var deserializedHighlights = hl.deserializeHighlights(jsonStr);
var actualHtml = $sandbox.html();
var serializedText = ($.map(json, function (val) { return val[1]; })).join('');
var expectedText = ($.map(params.highlights, function (val) { return val.rangeExpectedText; })).join('');

equal(expectedHtml, actualHtml, 'Serialization and deserialization successful');
equal(highlights.length, deserializedHighlights.length, 'All highlights deserialized');
equal(serializedText, expectedText, 'Highlights text ok');
}

test('Serialize one highlight', function() {
Expand Down

0 comments on commit 19169bb

Please sign in to comment.