From dcb0d9b0399eab0dd02a07aa259f3f32a2fad355 Mon Sep 17 00:00:00 2001 From: Ben Ogle Date: Tue, 1 Jul 2014 11:41:44 -0700 Subject: [PATCH] Update editor component specs --- spec/editor-component-spec.coffee | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/spec/editor-component-spec.coffee b/spec/editor-component-spec.coffee index 9ca48af92..a477e6cdf 100644 --- a/spec/editor-component-spec.coffee +++ b/spec/editor-component-spec.coffee @@ -285,13 +285,11 @@ describe "EditorComponent", -> expect(line0LeafNodes[1].textContent).toBe ' ' expect(line0LeafNodes[1].classList.contains('indent-guide')).toBe false - it "updates empty line indent guides when the guides change as a result of another line", -> + it "updates the indent guides on empty lines preceding an indentation change", -> editor.getBuffer().insert([12, 0], '\n') - nextTick() - - # The newline and he tab need to be in two different operations to surface the bug + runSetImmediateCallbacks() editor.getBuffer().insert([13, 0], ' ') - nextTick() + runSetImmediateCallbacks() line12LeafNodes = getLeafNodes(component.lineNodeForScreenRow(12)) expect(line12LeafNodes[0].textContent).toBe ' ' @@ -299,6 +297,18 @@ describe "EditorComponent", -> expect(line12LeafNodes[1].textContent).toBe ' ' expect(line12LeafNodes[1].classList.contains('indent-guide')).toBe true + it "updates the indent guides on empty lines following an indentation change", -> + editor.getBuffer().insert([12, 2], '\n') + runSetImmediateCallbacks() + editor.getBuffer().insert([12, 0], ' ') + runSetImmediateCallbacks() + + line13LeafNodes = getLeafNodes(component.lineNodeForScreenRow(13)) + expect(line13LeafNodes[0].textContent).toBe ' ' + expect(line13LeafNodes[0].classList.contains('indent-guide')).toBe true + expect(line13LeafNodes[1].textContent).toBe ' ' + expect(line13LeafNodes[1].classList.contains('indent-guide')).toBe true + getLeafNodes = (node) -> if node.children.length > 0 flatten(toArray(node.children).map(getLeafNodes))