This repository has been archived by the owner on Dec 28, 2022. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
110 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
describe 'Labeled list', -> | ||
grammar = null | ||
|
||
beforeEach -> | ||
waitsForPromise -> | ||
atom.packages.activatePackage 'language-asciidoc' | ||
|
||
runs -> | ||
grammar = atom.grammars.grammarForScopeName 'source.asciidoc' | ||
|
||
it 'parses the grammar', -> | ||
expect(grammar).toBeDefined() | ||
expect(grammar.scopeName).toBe 'source.asciidoc' | ||
|
||
describe 'Should tokenizes labeled list when', -> | ||
|
||
it 'line ending with ::', -> | ||
{tokens} = grammar.tokenizeLine 'foobar::' | ||
expect(tokens).toHaveLength 2 | ||
expect(tokens[0]).toEqualJson value: 'foobar', scopes: ['source.asciidoc', 'markup.heading.list.asciidoc'] | ||
expect(tokens[1]).toEqualJson value: '::', scopes: ['source.asciidoc', 'markup.heading.list.asciidoc', 'markup.list.bullet.asciidoc'] | ||
|
||
it 'line ending with :::', -> | ||
{tokens} = grammar.tokenizeLine 'foobar:::' | ||
expect(tokens).toHaveLength 2 | ||
expect(tokens[0]).toEqualJson value: 'foobar', scopes: ['source.asciidoc', 'markup.heading.list.asciidoc'] | ||
expect(tokens[1]).toEqualJson value: ':::', scopes: ['source.asciidoc', 'markup.heading.list.asciidoc', 'markup.list.bullet.asciidoc'] | ||
|
||
it 'line ending with ::::', -> | ||
{tokens} = grammar.tokenizeLine 'foobar::::' | ||
expect(tokens).toHaveLength 2 | ||
expect(tokens[0]).toEqualJson value: 'foobar', scopes: ['source.asciidoc', 'markup.heading.list.asciidoc'] | ||
expect(tokens[1]).toEqualJson value: '::::', scopes: ['source.asciidoc', 'markup.heading.list.asciidoc', 'markup.list.bullet.asciidoc'] | ||
|
||
it 'line ending with ;;', -> | ||
{tokens} = grammar.tokenizeLine 'foobar;;' | ||
expect(tokens).toHaveLength 2 | ||
expect(tokens[0]).toEqualJson value: 'foobar', scopes: ['source.asciidoc', 'markup.heading.list.asciidoc'] | ||
expect(tokens[1]).toEqualJson value: ';;', scopes: ['source.asciidoc', 'markup.heading.list.asciidoc', 'markup.list.bullet.asciidoc'] | ||
|
||
it 'contains :: following by text', -> | ||
{tokens} = grammar.tokenizeLine 'foobar:: foobar' | ||
expect(tokens).toHaveLength 4 | ||
expect(tokens[0]).toEqualJson value: 'foobar', scopes: ['source.asciidoc', 'markup.heading.list.asciidoc'] | ||
expect(tokens[1]).toEqualJson value: '::', scopes: ['source.asciidoc', 'markup.heading.list.asciidoc', 'markup.list.bullet.asciidoc'] | ||
expect(tokens[2]).toEqualJson value: ' ', scopes: ['source.asciidoc', 'markup.heading.list.asciidoc'] | ||
expect(tokens[3]).toEqualJson value: 'foobar', scopes: ['source.asciidoc'] | ||
|
||
it 'contains ::: following by text', -> | ||
{tokens} = grammar.tokenizeLine 'foobar::: foobar' | ||
expect(tokens).toHaveLength 4 | ||
expect(tokens[0]).toEqualJson value: 'foobar', scopes: ['source.asciidoc', 'markup.heading.list.asciidoc'] | ||
expect(tokens[1]).toEqualJson value: ':::', scopes: ['source.asciidoc', 'markup.heading.list.asciidoc', 'markup.list.bullet.asciidoc'] | ||
expect(tokens[2]).toEqualJson value: ' ', scopes: ['source.asciidoc', 'markup.heading.list.asciidoc'] | ||
expect(tokens[3]).toEqualJson value: 'foobar', scopes: ['source.asciidoc'] | ||
|
||
it 'contains :::: following by textcontains :: following by text', -> | ||
{tokens} = grammar.tokenizeLine 'foobar:::: foobar' | ||
expect(tokens).toHaveLength 4 | ||
expect(tokens[0]).toEqualJson value: 'foobar', scopes: ['source.asciidoc', 'markup.heading.list.asciidoc'] | ||
expect(tokens[1]).toEqualJson value: '::::', scopes: ['source.asciidoc', 'markup.heading.list.asciidoc', 'markup.list.bullet.asciidoc'] | ||
expect(tokens[2]).toEqualJson value: ' ', scopes: ['source.asciidoc', 'markup.heading.list.asciidoc'] | ||
expect(tokens[3]).toEqualJson value: 'foobar', scopes: ['source.asciidoc'] | ||
|
||
it 'contains ;; following by text', -> | ||
{tokens} = grammar.tokenizeLine 'foobar;; foobar' | ||
expect(tokens).toHaveLength 4 | ||
expect(tokens[0]).toEqualJson value: 'foobar', scopes: ['source.asciidoc', 'markup.heading.list.asciidoc'] | ||
expect(tokens[1]).toEqualJson value: ';;', scopes: ['source.asciidoc', 'markup.heading.list.asciidoc', 'markup.list.bullet.asciidoc'] | ||
expect(tokens[2]).toEqualJson value: ' ', scopes: ['source.asciidoc', 'markup.heading.list.asciidoc'] | ||
expect(tokens[3]).toEqualJson value: 'foobar', scopes: ['source.asciidoc'] | ||
|
||
describe 'Should not tokenize when', -> | ||
|
||
it 'title ending with space', -> | ||
{tokens} = grammar.tokenizeLine 'foobar ::' | ||
expect(tokens).toHaveLength 1 | ||
expect(tokens[0]).toEqualJson value: 'foobar ::', scopes: ['source.asciidoc'] | ||
|
||
it 'contains only one :', -> | ||
{tokens} = grammar.tokenizeLine 'foobar:' | ||
expect(tokens).toHaveLength 1 | ||
expect(tokens[0]).toEqualJson value: 'foobar:', scopes: ['source.asciidoc'] | ||
|
||
it 'following by test without space', -> | ||
{tokens} = grammar.tokenizeLine 'foobar:foobar' | ||
expect(tokens).toHaveLength 1 | ||
expect(tokens[0]).toEqualJson value: 'foobar:foobar', scopes: ['source.asciidoc'] |
File renamed without changes.
File renamed without changes.