Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
coopwire-hypothesis
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
孙灵跃 Leon Sun
coopwire-hypothesis
Commits
97f829b2
Commit
97f829b2
authored
Nov 14, 2014
by
Gergely Ujvari
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add more tests for stringHelper
parent
383cfa4c
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
34 additions
and
12 deletions
+34
-12
string-helpers.coffee
h/static/scripts/helpers/string-helpers.coffee
+1
-1
string-helpers-test.coffee
tests/js/helpers/string-helpers-test.coffee
+33
-11
No files found.
h/static/scripts/helpers/string-helpers.coffee
View file @
97f829b2
tests/js/helpers/string-helpers-test.coffee
View file @
97f829b2
...
...
@@ -10,22 +10,44 @@ describe 'h.helpers.stringHelpers', ->
stringHelpers
=
_stringHelpers_
describe
'.uniFold'
,
->
it
'
normalizes the input string
'
,
->
text
=
'
die Stra
\u
00DFe
'
it
'
removes hungarian marks
'
,
->
text
=
'
Fürge rőt róka túlszökik zsíros étkű kutyán
'
decoded
=
stringHelpers
.
uniFold
text
expected
=
'Furge rot roka tulszokik zsiros etku kutyan'
assert
.
equal
decoded
,
'die Straße'
assert
.
equal
decoded
,
expected
it
'calls the right normalization'
,
->
stub
=
sinon
.
stub
(
unorm
,
"nfkd"
).
returns
(
''
)
stringHelpers
.
uniFold
''
it
'removes greek marks'
,
->
text
=
'Καλημέρα κόσμε'
decoded
=
stringHelpers
.
uniFold
text
expected
=
'Καλημερα κοσμε'
sinon
.
assert
.
called
unorm
.
nfkd
stub
.
restore
()
assert
.
equal
decoded
,
expected
it
'removes
combining character
s'
,
->
text
=
'
Fürge rőt róka túlszökik zsíros étkű kutyán
'
it
'removes
japanese mark
s'
,
->
text
=
'
カタカナコンバータ
'
decoded
=
stringHelpers
.
uniFold
text
expected
=
'Furge rot roka tulszokik zsiros etku kutyan'
expected
=
'カタカナコンハータ'
assert
.
equal
decoded
,
expected
it
'removes marathi marks'
,
->
text
=
'काचं शक्नोम्यत्तुम'
decoded
=
stringHelpers
.
uniFold
text
expected
=
'कच शकनमयततम'
assert
.
equal
decoded
,
expected
it
'removes thai marks'
,
->
text
=
'ฉันกินกระจกได้ แต่มันไม่ทำให้ฉันเจ็บ'
decoded
=
stringHelpers
.
uniFold
text
expected
=
'ฉนกนกระจกได แตมนไมทาใหฉนเจบ'
assert
.
equal
decoded
,
expected
it
'removes all marks'
,
->
text
=
'̀ ́ ̂ ̃ ̄ ̅ ̆ ̇ ̈ ̉ ̊ ̋ ̌ ̍ ̎ ̏ ̐ ̑ ̒ ̓ ̔ ̕ ̖ ̗ ̘ ̙ ̚ ̛ ̜ ̝ ̞ ̟ ̠ ̡ ̢ ̣ ̤ ̥ ̦ ̧ ̨ ̩ ̪ ̫ ̬ ̭ ̮ ̯ ̰ ̱ ̲ ̳ ̴ ̵ ̶ ̷ ̸ ̹ ̺ ̻ ̼ ̽ ̾ ̿ ̀ ́ ͂ ̓ ̈́ ͅ ͠ ͡"'
decoded
=
stringHelpers
.
uniFold
text
expected
=
' "'
assert
.
equal
decoded
,
expected
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment