Skip to content

Commit

Permalink
Fix show omitted lines indicator at end in expanded mode
Browse files Browse the repository at this point in the history
  • Loading branch information
mattzeunert committed Jan 20, 2019
1 parent 0f79fdc commit 3f7e50d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ class CodeSnippetRenderer {
}
if (!lastLineIsVisible) {
snippet.append(CodeSnippetRenderer.renderOmittedLines(dom, tmpl,
LineVisibility.WHEN_COLLAPSED
LineVisibility.WHEN_EXPANDED
));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,12 @@ describe('DetailsRenderer', () => {
const visibleLines = el.querySelectorAll(
'.lh-code-snippet__line--code:not(.lh-code-snippet__show-if-expanded)');
const lastVisibleLine = visibleLines[visibleLines.length - 1];
const omittedLinesIndicators = el.querySelectorAll('.lh-code-snippet__line--empty');

// Shows first 5 visible lines
assert.equal(lastVisibleLine.textContent.replace(/\s/g, ''), '5E');
// "..." after the available lines, but only shows in expanded state
assert.equal(omittedLinesIndicators.length, 1);
assert.ok(omittedLinesIndicators[0].classList.contains('lh-code-snippet__show-if-expanded'));
});
});

0 comments on commit 3f7e50d

Please sign in to comment.