Added Polymer

This commit is contained in:
Thaum
2014-11-26 10:18:35 +00:00
parent 5eea4714b2
commit 3408ba9e8d
1210 changed files with 394645 additions and 47 deletions

View File

@@ -0,0 +1,5 @@
<!doctype html>
<title>marked tests</title>
<p>testing...</p>
<script src="marked.js"></script>
<script src="test.js"></script>

View File

@@ -0,0 +1,41 @@
var fs = require('fs');
var test = require('../')
, runTests = test.runTests
, load = test.load;
var express = require('express')
, app = express();
app.use(function(req, res, next) {
var setHeader = res.setHeader;
res.setHeader = function(name) {
switch (name) {
case 'Cache-Control':
case 'Last-Modified':
case 'ETag':
return;
}
return setHeader.apply(res, arguments);
};
next();
});
var dir = __dirname + '/../tests'
, files = {};
app.get('/test.js', function(req, res, next) {
var test = fs.readFileSync(__dirname + '/test.js', 'utf8')
, files = load();
test = test.replace('__TESTS__', JSON.stringify(files));
test = test.replace('__MAIN__', runTests + '');
res.contentType('.js');
res.send(test);
});
app.use(express.static(__dirname + '/../../lib'));
app.use(express.static(__dirname));
app.listen(8080);

View File

@@ -0,0 +1,62 @@
;(function() {
var console = {}
, files = __TESTS__;
console.log = function(text) {
var args = Array.prototype.slice.call(arguments, 1)
, i = 0;
text = text.replace(/%\w/g, function() {
return args[i++] || '';
});
if (window.console) window.console.log(text);
document.body.innerHTML += '<pre>' + escape(text) + '</pre>';
};
if (!Object.keys) {
Object.keys = function(obj) {
var out = []
, key;
for (key in obj) {
if (Object.prototype.hasOwnProperty.call(obj, key)) {
out.push(key);
}
}
return out;
};
}
if (!Array.prototype.forEach) {
Array.prototype.forEach = function(callback, context) {
for (var i = 0; i < this.length; i++) {
callback.call(context || null, this[i], i, obj);
}
};
}
if (!String.prototype.trim) {
String.prototype.trim = function() {
return this.replace(/^\s+|\s+$/g, '');
};
}
function load() {
return files;
}
function escape(html, encode) {
return html
.replace(!encode ? /&(?!#?\w+;)/g : /&/g, '&amp;')
.replace(/</g, '&lt;')
.replace(/>/g, '&gt;')
.replace(/"/g, '&quot;')
.replace(/'/g, '&#39;');
}
(__MAIN__)();
}).call(this);