public void Uses_indent_of_first_line() { var command = CreateSUT(); var inputText = new TestText( "Feature: foo", "Scenario: bar", "Given table", " | foo | bar |", " | bazbaz | qux | ", "| quux| corge| ", ""); var textView = CreateTextView(inputText); inputText.MoveCaretTo(textView, -2, 0); command.PostExec(textView, '|'); // this does not enter the char itself var expectedText = new TestText( "Feature: foo", "Scenario: bar", "Given table", " | foo | bar |", " | bazbaz | qux |", " | quux | corge |", ""); Assert.Equal(expectedText.ToString(), textView.TextSnapshot.GetText()); }
public void Uses_configured_line_ending() { var command = CreateSUT(); var inputText = new TestText( "Feature: foo", "Scenario: bar", "Given table", " | foo | bar |", " | bazbaz | qux | ", "| quux| corge| ", ""); var configuredNewLine = "\n"; var textView = CreateTextView(inputText, configuredNewLine); textView.StubEditorOptions.ReplicateNewLineCharacterOption = false; textView.StubEditorOptions.NewLineCharacterOption = configuredNewLine; inputText.MoveCaretTo(textView, -2, 0); command.PostExec(textView, '|'); // this does not enter the char itself var expectedText = new TestText( "Feature: foo", "Scenario: bar", "Given table", " | foo | bar |", " | bazbaz | qux |", " | quux | corge |", ""); Assert.Equal(expectedText.ToString(configuredNewLine), textView.TextSnapshot.GetText()); }
public void Should_not_remove_unfinished_cells_when_formattig_table() { var command = CreateSUT(); var inputText = new TestText( @"Feature: foo", @"Scenario: bar", @"Given table", @" | foo | bar ", @" | foo | bar baz ", @" | foo ", @" | ", @" | foo | ", @" | foo | \| ", @" | foo | \|", @" | foo | bar \\| ", @" | foo | bar ", @""); var textView = CreateTextView(inputText); inputText.MoveCaretTo(textView, -2, -1); textView.SimulateType(command, '|'); var expectedText = new TestText( @"Feature: foo", @"Scenario: bar", @"Given table", @" | foo | bar", @" | foo | bar baz", @" | foo", @" |", @" | foo |", @" | foo | \|", @" | foo | \|", @" | foo | bar \\ |", @" | foo | bar |", @""); Assert.Equal(expectedText.ToString(), textView.TextSnapshot.GetText()); }