mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2024-11-27 20:10:03 +00:00
76e8640c31
Some of the time we need to treat non-breaking spaces as though they are not spaces (regexps treat them as spaces by default).
30 lines
905 B
JavaScript
30 lines
905 B
JavaScript
/*\
|
|
title: test-utils.js
|
|
type: application/javascript
|
|
tags: [[$:/tags/test-spec]]
|
|
|
|
Tests various utility functions.
|
|
|
|
\*/
|
|
(function(){
|
|
|
|
/*jslint node: true, browser: true */
|
|
/*global $tw: false */
|
|
"use strict";
|
|
|
|
describe("Utility tests", function() {
|
|
|
|
it("should handle parsing a string array", function() {
|
|
expect($tw.utils.parseStringArray("Tiddler8")).toEqual(["Tiddler8"]);
|
|
expect($tw.utils.parseStringArray(" Tiddler8")).toEqual(["Tiddler8"]);
|
|
expect($tw.utils.parseStringArray("Tiddler8 ")).toEqual(["Tiddler8"]);
|
|
expect($tw.utils.parseStringArray("Tiddler8 two")).toEqual(["Tiddler8","two"]);
|
|
expect($tw.utils.parseStringArray(" Tiddler8 two ")).toEqual(["Tiddler8","two"]);
|
|
expect($tw.utils.parseStringArray(" Tidd\u00a0ler8 two ")).toEqual(["Tidd\u00a0ler8","two"]);
|
|
expect($tw.utils.parseStringArray(" [[Tidd\u00a0ler8]] two ")).toEqual(["Tidd\u00a0ler8","two"]);
|
|
});
|
|
|
|
});
|
|
|
|
})();
|