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

Side by Side 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, 5 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 unified diff | Download patch
OLDNEW
(Empty)
1 <!doctype html>
2 <!--
3 @license
4 Copyright (c) 2015 The Polymer Project Authors. All rights reserved.
5 This code may only be used under the BSD style license found at http://polymer.g ithub.io/LICENSE.txt
6 The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
7 The complete set of contributors may be found at http://polymer.github.io/CONTRI BUTORS.txt
8 Code distributed by Google as part of the polymer project is also
9 subject to an additional IP rights grant found at http://polymer.github.io/PATEN TS.txt
10 -->
11 <html>
12 <head>
13 <meta charset="UTF-8">
14 <title>marked-element basic tests</title>
15 <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum- scale=1.0">
16
17 <script src="../../webcomponentsjs/webcomponents-lite.js"></script>
18 <script src="../../web-component-tester/browser.js"></script>
19 <script src="../../test-fixture/test-fixture-mocha.js"></script>
20
21 <link rel="import" href="../../test-fixture/test-fixture.html">
22 <link rel="import" href="../../polymer/polymer.html">
23 <link rel="import" href="../marked-element.html">
24 </head>
25 <body>
26
27 <test-fixture id="CamelCaseHTML">
28 <template>
29 <marked-element>
30 <script type="text/markdown">
31 ```html
32 <div camelCase></div>
33 ```
34 </script>
35 </marked-element>
36 </template>
37 </test-fixture>
38
39 <test-fixture id="BadHTML">
40 <template>
41 <marked-element>
42 <script type="text/markdown">
43 ```html
44 <p><div></p></div>
45 ```
46 </script>
47 </marked-element>
48 </template>
49 </test-fixture>
50
51 <script>
52 'use strict';
53
54 // Replace reserved HTML characters with their character entity equivalents to match the
55 // transform done by Markdown.
56 //
57 // The Marked library itself is not used because it wraps code blocks in `<c ode><pre>`, which is
58 // superfluous for testing purposes.
59 function escapeHTML(string) {
60 var span = document.createElement('span');
61 span.textContent = string;
62 return span.innerHTML;
63 }
64
65 suite('<marked-element>', function() {
66
67 suite('respsects camelCased HTML', function() {
68 var markedElement;
69 var proofElement;
70
71 setup(function() {
72 markedElement = fixture('CamelCaseHTML');
73 proofElement = document.createElement('div');
74 });
75
76 test('in code blocks', function() {
77 proofElement.innerHTML = '<div camelCase></div>';
78
79 // If Markdown content were put into a `<template>` or directly into t he DOM, it would be
80 // rendered as DOM and be converted from camelCase to lowercase per HT ML parsing rules. By
81 // using `<script>` descendants, content is interpreted as plain text.
82 expect(proofElement.innerHTML).to.eql('<div camelcase=""></div>')
83 expect(markedElement.$.content.innerHTML).to.include(escapeHTML('<div camelCase>'));
84 });
85 });
86
87 suite('respsects bad HTML', function() {
88 var markedElement;
89 var proofElement;
90
91 setup(function() {
92 markedElement = fixture('BadHTML');
93 proofElement = document.createElement('div');
94 });
95
96 test('in code blocks', function() {
97 proofElement.innerHTML = '<p><div></p></div>';
98
99 // If Markdown content were put into a `<template>` or directly into t he DOM, it would be
100 // rendered as DOM and close unbalanced tags. Because they are in code blocks they should
101 // remain as typed.
102 expect(proofElement.innerHTML).to.eql('<p></p><div><p></p></div>');
103 expect(markedElement.$.content.innerHTML).to.include(escapeHTML('<p><d iv></p></div>'));
104 });
105 });
106
107 });
108
109 </script>
110
111 </body>
112 </html>
OLDNEW
« 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