Permalink
Browse files

Added test files for lint and fixed error.

1 parent b8836a3 commit 06e8f1ef6a2ac2c4eaa549f5b65b747eb3e44995 @hackerwins hackerwins committed Jan 28, 2016
View
@@ -3,6 +3,7 @@
"disallowMultipleLineBreaks": true,
"excludeFiles": [
"src/js/intro.js",
- "src/js/outro.js"
+ "src/js/outro.js",
+ "test/libs/*.js"
]
}
View
@@ -107,7 +107,7 @@ module.exports = function (grunt) {
},
jscs: {
- src: '*.js',
+ src: ['*.js', 'src/**/*.js', 'test/**/*.js'],
gruntfile: 'Gruntfile.js',
build: 'build'
},
View
Oops, something went wrong.
@@ -187,7 +187,6 @@ define([
return this;
};
-
/**
* Moves the scrollbar to start container(sc) of current range
*
@@ -46,7 +46,6 @@ define(['summernote/base/core/range'], function (range) {
applySnapshot(stack[stackOffset]);
};
-
/**
* @method reset
* Resets the history stack completely; reverting to an empty editor.
@@ -66,7 +66,6 @@ define([
context.triggerEvent('paste', event);
});
-
// init content before set event
$editable.html(dom.html($note) || dom.emptyPara);
@@ -453,7 +452,6 @@ define([
};
/* jshint ignore:end */
-
/**
* fontSize
*
@@ -497,7 +495,6 @@ define([
});
context.memo('help.insertHorizontalRule', lang.help.insertHorizontalRule);
-
/**
* remove bogus node and character
*/
@@ -118,7 +118,6 @@ define([
return $video[0];
};
-
this.show = function () {
var text = context.invoke('editor.getSelectedText');
context.invoke('editor.saveRange');
@@ -229,7 +229,6 @@ define([
});
});
-
describe('splitTree', function () {
var $para;
beforeEach(function () {
@@ -185,8 +185,6 @@ define([
describe('createLink', function () {
it('should make normal link', function () {
- //context.invoke('code', '<p>Hello World</p>');
-
var text = 'hello';
var editable = context.layoutInfo.editable;
@@ -199,26 +197,15 @@ define([
// check creation normal link
editor.createLink({
- url : 'http://summernote.org',
- text : 'summernote'
+ url: 'http://summernote.org',
+ text: 'summernote'
});
- // wheather a tag is created
- expect(editable.find('a').length).to.equal(1);
-
- // check href
- expect(editable.find('a').attr('href')).to.equal('http://summernote.org');
-
- // check text
- expect(editable.find('a').html()).to.equal('summernote');
+ expectContents(context, '<p>hello<a href="http://summernote.org">summernote</a></p>');
});
-
it('should make a link with range', function () {
- //context.invoke('code', '<p>Hello World</p>');
-
var text = 'hello';
-
var editable = context.layoutInfo.editable;
var pNode = editable.find('p')[0];
var textNode = pNode.childNodes[0];
@@ -227,31 +214,17 @@ define([
var rng = range.create(textNode, startIndex, textNode, endIndex);
- // check creation normal link
editor.createLink({
- url : 'http://summernote.org',
- text : 'summernote',
- range : rng
+ url: 'http://summernote.org',
+ text: 'summernote',
+ range: rng
});
- // wheather a tag is created
- expect(editable.find('a').length).to.equal(1);
-
- // check href
- expect(editable.find('a').attr('href')).to.equal('http://summernote.org');
-
- // check text
- expect(editable.find('a').html()).to.equal('summernote');
-
- // check full text
expectContents(context, '<p><a href="http://summernote.org">summernote</a></p>');
});
it('should make a link with isNewWindow', function () {
- //context.invoke('code', '<p>Hello World</p>');
-
var text = 'hello';
-
var editable = context.layoutInfo.editable;
var pNode = editable.find('p')[0];
var textNode = pNode.childNodes[0];
@@ -260,53 +233,29 @@ define([
var rng = range.create(textNode, startIndex, textNode, endIndex);
- // check creation normal link
editor.createLink({
- url : 'http://summernote.org',
- text : 'summernote',
- range : rng,
- isNewWindow : true
+ url: 'http://summernote.org',
+ text: 'summernote',
+ range: rng,
+ isNewWindow: true
});
- // wheather a tag is created
- expect(editable.find('a').length).to.equal(1);
-
- // check href
- expect(editable.find('a').attr('href')).to.equal('http://summernote.org');
-
- // check target
- expect(editable.find('a').attr('target')).to.equal('_blank');
-
- // check text
- expect(editable.find('a').html()).to.equal('summernote');
-
- // check full text
expectContents(context, '<p><a href="http://summernote.org" target="_blank">summernote</a></p>');
});
-
it('should modify a link ', function () {
context.invoke('code', '<p><a href="http://summernote.org">hello world</a></p>');
var editable = context.layoutInfo.editable;
var anchorNode = editable.find('a')[0];
-
var rng = range.createFromNode(anchorNode);
- // check creation normal link
editor.createLink({
- url : 'http://wow.summernote.org',
- text : 'summernote Wow',
- range : rng
+ url: 'http://wow.summernote.org',
+ text: 'summernote Wow',
+ range: rng
});
- // check href
- expect(editable.find('a').attr('href')).to.equal('http://wow.summernote.org');
-
- // check text
- expect(editable.find('a').html()).to.equal('summernote Wow');
-
- // check full text
expectContents(context, '<p><a href="http://wow.summernote.org">summernote Wow</a></p>');
});
});

0 comments on commit 06e8f1e

Please sign in to comment.