steveathon / bootstrap-wysiwyg

Tiny bootstrap-compatible WYSIWYG rich text editor
MIT License
663 stars 1.7k forks source link

Add CI build #42

Open codewithtyler opened 9 years ago

codewithtyler commented 9 years ago

I've been doing a lot of linting, minifying, etc in my recent PRs. I think we should add CI build so that when a PR is made things like HTML validation, LESS & SASS compilation, JS linting, etc. are all done automatically.

For those not familiar with CI, this would help for the following reasons:

  1. For a while, there were several problems in the bootstrap-wysiwyg.js fie. It wasn't until the file was linted that some of the problems were found. This would take care of that because every time a PR is made the JS files will be linted and the HTML validated.
  2. Not everyone uses Gulp, so we need a way to do this automatically for those developers as well.
  3. As I already said each PR would be validated and linted. So by adding a CI build, we will be able to keep a level of consistency in the project.
codewithtyler commented 9 years ago

Suggestion: Travis-CI and Appveyor both support Node.js projects, which would be required to use our gulp tasks as our CI tests. So I suggest that we use one of these two CI sites.

codewithtyler commented 9 years ago

@steveathon per our previous discussion we talked about using Travis CI to do our tests since Grunt and QUnit are used natively in Travis. I'd also like to suggest that we set up the minified bootstrap-wysiwyg.min.js as an artifact. That way whenever someone creates a PR we have a file we can use for testing purposes prior to approving the PR.

codewithtyler commented 8 years ago

Since making the library OOP and adding a CI build is kinda one in the same project I'm going to add this link below. Basically the OOP has been merged in the 2.0-dev branch. Moving forward in that branch I think we should consider the idea of being able to chain our functions. Per this JS tip it doesn't look like it would be that difficult to do this and I think it could possibly add some potential to our functions as we improve on this new OOP code.

codewithtyler commented 8 years ago

Update: As previously stated it would be great if each commit and PR made automatically validated and linted the files. I also figured that since we are working on setting up a CI build it probably wouldn't hurt for us to have something for Travis CI to run. So I've went ahead and started working on adding unit tests. Once I finish that I'll update Travis CI so that it not only checks the unit tests but also runs our lint and HTML validation tasks.

Here's where I'm at so far on the unit tests. All methods are listed and I have included numbers which specify how many tests I have completed and the total number of tests for that method. The total number of tests for each method should cover all scenarios for that particular method.

Method Name Tests Completed/Total # of Tests
readFileIntoDataUrl 1/1
execCommand 5/5
getCurrentRange 3/3
saveSelection 1/1
restoreSelection 2/2
toggleHtmlEdit 2/2
markSelection 1/1
cleanHtml 0/6? Tests Added
updateToolbar 0/11? Tests Added
bindHotkeys 0/3 Tests Added
insertFiles 0/2? Tests Added
bindToolbar 0/14? Tests Added
initFileDrops 0/2 Tests Added

As you've probably noticed some methods have a ? beside the total number of tests. This is how many tests I have estimated it will take to cover all possible scenarios for the method and is likely to change as I start the test for that method.

codewithtyler commented 7 years ago

@kaptainkommie you seem to have a good interest in continuing this project. When you're finished with the resize feature if you're up to it I think finishing these unit tests would be a good step forward to making this project more stable. If I remember right the test I made was in the add-tests branch of my fork. Sadly my schedule got busier than normal and I was never able to finish it. If you do decide to take this task on I'll be happy to answer any questions you may have on the unit tests. Also just an FYI my branch is a little behind the 2.0 branch.