Estevão Soares dos Santos 10 лет назад
Родитель
Сommit
1d149c8806

+ 3 - 0
Gruntfile.js

@@ -39,6 +39,9 @@ module.exports = function (grunt) {
     },
 
     jshint: {
+      options: {
+        jshintrc: '.jshintrc'
+      },
       files: [
         'Gruntfile.js',
         'src/**/*.js',

+ 2 - 2
dist/showdown.js

@@ -1,4 +1,4 @@
-;/*! showdown 16-06-2015 */
+;/*! showdown 17-06-2015 */
 (function(){
 /**
  * Created by Tivie on 06-01-2015.
@@ -1703,7 +1703,7 @@ showdown.subParser('lists', function (text, options, globals) {
       var txt = results[i].slice(2),
           nListType = results[i].slice(0, 2);
 
-      if (listType != nListType) {
+      if (listType !== nListType) {
         y++;
         holder[y] = [];
         holder[y].type = nListType;

Разница между файлами не показана из-за своего большого размера
+ 0 - 0
dist/showdown.js.map


Разница между файлами не показана из-за своего большого размера
+ 1 - 1
dist/showdown.min.js


Разница между файлами не показана из-за своего большого размера
+ 0 - 0
dist/showdown.min.js.map


+ 1 - 1
src/subParsers/lists.js

@@ -99,7 +99,7 @@ showdown.subParser('lists', function (text, options, globals) {
       var txt = results[i].slice(2),
           nListType = results[i].slice(0, 2);
 
-      if (listType != nListType) {
+      if (listType !== nListType) {
         y++;
         holder[y] = [];
         holder[y].type = nListType;

+ 79 - 71
test/bootstrap.js

@@ -3,87 +3,95 @@
  */
 
 //jscs:disable requireCamelCaseOrUpperCaseIdentifiers
-require('source-map-support').install();
-require('chai').should();
-var fs = require('fs'),
+(function () {
+  'use strict';
+
+  require('source-map-support').install();
+  require('chai').should();
+  var fs = require('fs'),
     os = require('os'),
+  /*jshint -W106 */
     beautify = require('js-beautify').html_beautify,
     beauOptions = {
       eol: os.EOL,
       indent_size: 2,
       preserve_newlines: false
     };
+  /*jshint +W106 */
 
-function getTestSuite(dir) {
-  return fs.readdirSync(dir)
-    .filter(filter())
-    .map(map(dir));
-}
+  function getTestSuite(dir) {
+    return fs.readdirSync(dir)
+      .filter(filter())
+      .map(map(dir));
+  }
 
-function filter() {
-  return function (file) {
-    var ext = file.slice(-3);
-    return (ext === '.md');
-  };
-}
-
-function map(dir) {
-  return function (file) {
-    var name = file.replace('.md', ''),
-      htmlPath = dir + name + '.html',
-      html = fs.readFileSync(htmlPath, 'utf8'),
-      mdPath = dir + name + '.md',
-      md = fs.readFileSync(mdPath, 'utf8');
-
-    return {
-      name:     name,
-      input:    md,
-      expected: html
+  function filter() {
+    return function (file) {
+      var ext = file.slice(-3);
+      return (ext === '.md');
     };
-  };
-}
+  }
+
+  function map(dir) {
+    return function (file) {
+      var name = file.replace('.md', ''),
+        htmlPath = dir + name + '.html',
+        html = fs.readFileSync(htmlPath, 'utf8'),
+        mdPath = dir + name + '.md',
+        md = fs.readFileSync(mdPath, 'utf8');
+
+      return {
+        name:     name,
+        input:    md,
+        expected: html
+      };
+    };
+  }
+
+  function assertion(testCase, converter) {
+    return function () {
+      testCase.actual = converter.makeHtml(testCase.input);
+      testCase = normalize(testCase);
+
+      // Compare
+      testCase.actual.should.equal(testCase.expected);
+    };
+  }
+
+  //Normalize input/output
+  function normalize(testCase) {
+
+    // Normalize line returns
+    testCase.expected = testCase.expected.replace(/(\r\n)|\n|\r/g, '\n');
+    testCase.actual = testCase.actual.replace(/(\r\n)|\n|\r/g, '\n');
+
+    // Ignore all leading/trailing whitespace
+    testCase.expected = testCase.expected.split('\n').map(function (x) {
+      return x.trim();
+    }).join('\n');
+    testCase.actual = testCase.actual.split('\n').map(function (x) {
+      return x.trim();
+    }).join('\n');
 
-function assertion(testCase, converter) {
-  return function () {
-    testCase.actual = converter.makeHtml(testCase.input);
-    testCase = normalize(testCase);
+    // Remove extra lines
+    testCase.expected = testCase.expected.trim();
+    testCase.actual = testCase.actual.trim();
 
-    // Compare
-    testCase.actual.should.equal(testCase.expected);
+    //Beautify
+    testCase.expected = beautify(testCase.expected, beauOptions);
+    testCase.actual = beautify(testCase.actual, beauOptions);
+
+    // Normalize line returns
+    testCase.expected = testCase.expected.replace(/(\r\n)|\n|\r/g, os.EOL);
+    testCase.actual = testCase.actual.replace(/(\r\n)|\n|\r/g, os.EOL);
+
+    return testCase;
+  }
+
+  module.exports = {
+    getTestSuite: getTestSuite,
+    assertion: assertion,
+    normalize: normalize,
   };
-}
-
-//Normalize input/output
-function normalize(testCase) {
-
-  // Normalize line returns
-  testCase.expected = testCase.expected.replace(/(\r\n)|\n|\r/g, '\n');
-  testCase.actual = testCase.actual.replace(/(\r\n)|\n|\r/g, '\n');
-
-  // Ignore all leading/trailing whitespace
-  testCase.expected = testCase.expected.split('\n').map(function (x) {
-    return x.trim();
-  }).join('\n');
-  testCase.actual = testCase.actual.split('\n').map(function (x) {
-    return x.trim();
-  }).join('\n');
-
-  // Remove extra lines
-  testCase.expected = testCase.expected.trim();
-  testCase.actual = testCase.actual.trim();
-
-  //Beautify
-  testCase.expected = beautify(testCase.expected, beauOptions);
-  testCase.actual = beautify(testCase.actual, beauOptions);
-
-  // Normalize line returns
-  testCase.expected = testCase.expected.replace(/(\r\n)|\n|\r/g, os.EOL);
-  testCase.actual = testCase.actual.replace(/(\r\n)|\n|\r/g, os.EOL);
-
-  return testCase;
-}
-
-module.exports = {
-  getTestSuite: getTestSuite,
-  assertion: assertion
-};
+})();
+

+ 1 - 1
test/node/testsuite.issues.js

@@ -7,8 +7,8 @@ var showdown = require('../../dist/showdown.js'),
   assertion = bootstrap.assertion,
   testsuite = bootstrap.getTestSuite('test/issues/');
 
-//MD-Testsuite (borrowed from karlcow/markdown-testsuite)
 describe('makeHtml() issues testsuite', function () {
+  'use strict';
   for (var i = 0; i < testsuite.length; ++i) {
     it(testsuite[i].name, assertion(testsuite[i], converter));
   }

+ 1 - 0
test/node/testsuite.karlcow.js

@@ -6,6 +6,7 @@ var showdown = require('../../dist/showdown.js'),
 
 //MD-Testsuite (borrowed from karlcow/markdown-testsuite)
 describe('makeHtml() karlcow testsuite', function () {
+  'use strict';
   for (var i = 0; i < testsuite.length; ++i) {
     it(testsuite[i].name, assertion(testsuite[i], converter));
   }

+ 1 - 1
test/node/testsuite.standard.js

@@ -4,8 +4,8 @@ var showdown = require('../../dist/showdown.js'),
     assertion = bootstrap.assertion,
     testsuite = bootstrap.getTestSuite('test/cases/');
 
-//MD-Testsuite (borrowed from karlcow/markdown-testsuite)
 describe('makeHtml() standard testsuite', function () {
+  'use strict';
   for (var i = 0; i < testsuite.length; ++i) {
     it(testsuite[i].name, assertion(testsuite[i], converter));
   }

Некоторые файлы не были показаны из-за большого количества измененных файлов