Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(247)

Unified Diff: tools/vulcanize/node_modules/vulcanize/node_modules/cheerio/node_modules/entities/test/test.js

Issue 125733002: Add vulcanize to tools. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: tools/vulcanize/node_modules/vulcanize/node_modules/cheerio/node_modules/entities/test/test.js
diff --git a/tools/vulcanize/node_modules/vulcanize/node_modules/cheerio/node_modules/entities/test/test.js b/tools/vulcanize/node_modules/vulcanize/node_modules/cheerio/node_modules/entities/test/test.js
new file mode 100644
index 0000000000000000000000000000000000000000..fa6c00df0ba28ac8ec7418bcb30d0fe21e3cc130
--- /dev/null
+++ b/tools/vulcanize/node_modules/vulcanize/node_modules/cheerio/node_modules/entities/test/test.js
@@ -0,0 +1,68 @@
+var assert = require("assert");
+var entities = require('../');
+
+describe("Encode->decode test", function() {
+ var testcases = [
+ {
+ input: "asdf & ÿ ü '",
+ xml: "asdf & ÿ ü '",
+ html4: "asdf & ÿ ü '",
+ html5: "asdf & ÿ ü '"
+ }, {
+ input: "&",
+ xml: "&",
+ html4: "&",
+ html5: "&"
+ },
+ ];
+ testcases.forEach(function(tc) {
+ var encodedXML = entities.encodeXML(tc.input);
+ it("should XML encode " + tc.input, function() {
+ assert.equal(encodedXML, tc.xml);
+ });
+ it("should XML decode " + encodedXML, function() {
+ assert.equal(entities.decodeXML(encodedXML), tc.input);
+ });
+ var encodedHTML4 = entities.encodeHTML4(tc.input);
+ it("should HTML4 encode " + tc.input, function() {
+ assert.equal(encodedHTML4, tc.html4);
+ });
+ it("should HTML4 decode " + encodedHTML4, function() {
+ assert.equal(entities.decodeHTML4(encodedHTML4), tc.input);
+ });
+ var encodedHTML5 = entities.encodeHTML5(tc.input);
+ it("should HTML5 encode " + tc.input, function() {
+ assert.equal(encodedHTML5, tc.html5);
+ });
+ it("should HTML5 decode " + encodedHTML5, function() {
+ assert.equal(entities.decodeHTML5(encodedHTML5), tc.input);
+ });
+ });
+});
+
+describe("Decode test", function() {
+ var testcases = [
+ { input: "&", output: "&" },
+ { input: "&", output: "&" },
+ { input: "&", output: "&" },
+ { input: "&", output: "&" },
+ { input: "&", output: "&" },
+ { input: "&", output: "&" },
+ { input: "&", output: "&" },
+ { input: ":", output: ":" },
+ { input: ":", output: ":" },
+ { input: ":", output: ":" },
+ { input: ":", output: ":" }
+ ];
+ testcases.forEach(function(tc) {
+ it("should XML decode " + tc.input, function() {
+ assert.equal(entities.decodeXML(tc.input), tc.output);
+ });
+ it("should HTML4 decode " + tc.input, function() {
+ assert.equal(entities.decodeHTML4(tc.input), tc.output);
+ });
+ it("should HTML5 decode " + tc.input, function() {
+ assert.equal(entities.decodeHTML5(tc.input), tc.output);
+ });
+ });
+});

Powered by Google App Engine
This is Rietveld 408576698