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
117 additions
and
62 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
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,45 @@ | ||
'use strict'; | ||
|
||
const assert = require('chai').assert; | ||
const rules = require('../build/rules'); | ||
const Typograf = require('../build/typograf'); | ||
const t = new Typograf(); | ||
|
||
describe('Entities', function() { | ||
it('should get entities as name or digit', function() { | ||
const t2 = new Typograf({mode: 'name'}); | ||
assert.equal(t2.execute('1\u00A02'), '1 2'); | ||
assert.equal(t2.execute('1 2'), '1 2'); | ||
|
||
const t3 = new Typograf({mode: 'digit'}); | ||
assert.equal(t3.execute('1\u00A02'), '1 2'); | ||
assert.equal(t3.execute('1 2'), '1 2'); | ||
}); | ||
|
||
it('should get entities as name only for invisible symbols', function() { | ||
const t = new Typograf({mode: 'name-invisible'}); | ||
assert.equal(t.execute('1\u00A02… a\u00A0b…'), '1 2… a b…'); | ||
}); | ||
|
||
it('should get entities as digit only for invisible symbols', function() { | ||
const t = new Typograf({mode: 'digit-invisible'}); | ||
assert.equal(t.execute('1\u00A02… a\u00A0b…'), '1 2… a b…'); | ||
}); | ||
|
||
it('should get entities as name or digit with method "execute"', function() { | ||
const t2 = new Typograf(); | ||
assert.equal(t2.execute('1\u00A02\u00A03', {mode: 'name'}), '1 2 3'); | ||
assert.equal(t2.execute('1 2 3', {mode: 'name'}), '1 2 3'); | ||
assert.equal(t2.execute('1 2 3', {mode: 'name'}), '1 2 3'); | ||
assert.equal(t2.execute('1 2 3', {mode: 'name'}), '1 2 3'); | ||
assert.equal(t2.execute('1 2 3', {mode: 'name'}), '1 2 3'); | ||
|
||
const t3 = new Typograf(); | ||
assert.equal(t3.execute('1\u00A02\u00A03', {mode: 'digit'}), '1 2 3'); | ||
assert.equal(t3.execute('1 2 3', {mode: 'digit'}), '1 2 3'); | ||
assert.equal(t3.execute('1 2 3', {mode: 'digit'}), '1 2 3'); | ||
assert.equal(t3.execute('1 2 3', {mode: 'digit'}), '1 2 3'); | ||
assert.equal(t3.execute('1 2 3', {mode: 'digit'}), '1 2 3'); | ||
assert.equal(t3.execute('1 2 3', {mode: 'digit'}), '1 2 3'); | ||
}); | ||
}); |