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

Unified Diff: polymer_1.0.4/bower_components/marked-element/test/marked-element.html

Issue 1205703007: Add polymer 1.0 to npm_modules (Closed) Base URL: https://chromium.googlesource.com/infra/third_party/npm_modules.git@master
Patch Set: Renamed folder to 1.0.4 Created 5 years, 6 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: polymer_1.0.4/bower_components/marked-element/test/marked-element.html
diff --git a/polymer_1.0.4/bower_components/marked-element/test/marked-element.html b/polymer_1.0.4/bower_components/marked-element/test/marked-element.html
new file mode 100644
index 0000000000000000000000000000000000000000..2535dd1746702e03a749fcbded86e74167808fa1
--- /dev/null
+++ b/polymer_1.0.4/bower_components/marked-element/test/marked-element.html
@@ -0,0 +1,112 @@
+<!doctype html>
+<!--
+@license
+Copyright (c) 2015 The Polymer Project Authors. All rights reserved.
+This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
+The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
+The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
+Code distributed by Google as part of the polymer project is also
+subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
+-->
+<html>
+<head>
+ <meta charset="UTF-8">
+ <title>marked-element basic tests</title>
+ <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0">
+
+ <script src="../../webcomponentsjs/webcomponents-lite.js"></script>
+ <script src="../../web-component-tester/browser.js"></script>
+ <script src="../../test-fixture/test-fixture-mocha.js"></script>
+
+ <link rel="import" href="../../test-fixture/test-fixture.html">
+ <link rel="import" href="../../polymer/polymer.html">
+ <link rel="import" href="../marked-element.html">
+</head>
+<body>
+
+ <test-fixture id="CamelCaseHTML">
+ <template>
+ <marked-element>
+ <script type="text/markdown">
+```html
+<div camelCase></div>
+```
+ </script>
+ </marked-element>
+ </template>
+ </test-fixture>
+
+ <test-fixture id="BadHTML">
+ <template>
+ <marked-element>
+ <script type="text/markdown">
+```html
+<p><div></p></div>
+```
+ </script>
+ </marked-element>
+ </template>
+ </test-fixture>
+
+ <script>
+ 'use strict';
+
+ // Replace reserved HTML characters with their character entity equivalents to match the
+ // transform done by Markdown.
+ //
+ // The Marked library itself is not used because it wraps code blocks in `<code><pre>`, which is
+ // superfluous for testing purposes.
+ function escapeHTML(string) {
+ var span = document.createElement('span');
+ span.textContent = string;
+ return span.innerHTML;
+ }
+
+ suite('<marked-element>', function() {
+
+ suite('respsects camelCased HTML', function() {
+ var markedElement;
+ var proofElement;
+
+ setup(function() {
+ markedElement = fixture('CamelCaseHTML');
+ proofElement = document.createElement('div');
+ });
+
+ test('in code blocks', function() {
+ proofElement.innerHTML = '<div camelCase></div>';
+
+ // If Markdown content were put into a `<template>` or directly into the DOM, it would be
+ // rendered as DOM and be converted from camelCase to lowercase per HTML parsing rules. By
+ // using `<script>` descendants, content is interpreted as plain text.
+ expect(proofElement.innerHTML).to.eql('<div camelcase=""></div>')
+ expect(markedElement.$.content.innerHTML).to.include(escapeHTML('<div camelCase>'));
+ });
+ });
+
+ suite('respsects bad HTML', function() {
+ var markedElement;
+ var proofElement;
+
+ setup(function() {
+ markedElement = fixture('BadHTML');
+ proofElement = document.createElement('div');
+ });
+
+ test('in code blocks', function() {
+ proofElement.innerHTML = '<p><div></p></div>';
+
+ // If Markdown content were put into a `<template>` or directly into the DOM, it would be
+ // rendered as DOM and close unbalanced tags. Because they are in code blocks they should
+ // remain as typed.
+ expect(proofElement.innerHTML).to.eql('<p></p><div><p></p></div>');
+ expect(markedElement.$.content.innerHTML).to.include(escapeHTML('<p><div></p></div>'));
+ });
+ });
+
+ });
+
+ </script>
+
+</body>
+</html>
« no previous file with comments | « polymer_1.0.4/bower_components/marked-element/test/index.html ('k') | polymer_1.0.4/bower_components/marked/.bower.json » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698