From 4a7fa26848722c9a873ec043ddb9789ea17a4d12 Mon Sep 17 00:00:00 2001 From: Vincent Pretre Date: Wed, 23 Oct 2019 11:21:27 +0200 Subject: [PATCH] [Gherkin / Javascript] Add test to ensure #290 is not present (and will not be) --- gherkin/javascript/test/GherkinLineTest.ts | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 gherkin/javascript/test/GherkinLineTest.ts diff --git a/gherkin/javascript/test/GherkinLineTest.ts b/gherkin/javascript/test/GherkinLineTest.ts new file mode 100644 index 00000000000..39979200501 --- /dev/null +++ b/gherkin/javascript/test/GherkinLineTest.ts @@ -0,0 +1,20 @@ +import * as assert from 'assert' +import GherkinLine from '../src/GherkinLine' + +describe('GherkinLine', function() { + function getCellsText(line: string) { + const gl = new GherkinLine(line, 1) + + return gl.getTableCells().map(span => span.text) + } + + it('getTableCells correctly trims cells content', function() { + assert.deepEqual(getCellsText("|spaces after |"), ['spaces after']) + assert.deepEqual(getCellsText("| \t spaces before|"), ['spaces before']) + assert.deepEqual(getCellsText("| \t spaces everywhere \t|"), ['spaces everywhere']) + }) + + it('getTableCells does not drop white spaces inside a cell', function() { + assert.deepEqual(getCellsText("| foo()\n bar\nbaz |"), ['foo()\n bar\nbaz']) + }) +}) \ No newline at end of file