Setting UpEdit this page on GitHub
Installation
- To install all the dependencies run
npm install. - Then run
bower installforjasmine,jqueryandunderscorelibrary dependencies. - Install grunt globally, which is a Javascript Task Runner
npm install -g grunt-cli.
Running Tests
- For testing, we use Jasmine.
- Tests are written in the
test/unitfolder. Each file in thesrcdirectory have different test cases files associataed with them in thetest/unitdirectory. The majority of the test cases that test the library as a black box are indom-comparator.spec.js. - To run tests, run
grunt; testem server;(from the root directory of the repository) - To see the final outputs open http://localhost:7357/ in the browser, open the JavaScript console and look for the
final_resultsarray.
Cases which don't work
- If there are multiple occurrences of a node in the DOM. For example:
nodeA:<div style="display: block;"> <ul class="navigation vwo_1405423029796" style="cursor: auto; display: block;"> </ul> <div class="clr">ORIGINAL TEXT</div> </div>
nodeB:<div class="clr">ORIGINAL TEXT</div> <div style="display: block;"> <ul class="navigation vwo_1405423029796" style="cursor: auto; display: INLINE;"> </ul> <div class="clr">ORIGINAL TEXT</div> </div>Here, since there are 2 occurrences of
<div class="clr">ORIGINAL TEXT</div>innodeB, the exact match of it cannot be found innodeA, due to which the resulted output is not as expected.
- When the wrapping of the original node is changed. For example:
nodeA:<div style="display: block;"> <div class="clr">ORIGINAL TEXT</div> </div>
nodeB:<div> <div style="display: block;"> <div class="clr">ORIGINAL TEXT</div> </div> </div>Here, since the wrapping of
nodeBis changed (wrapped by<div> ... </div>), the whole content innodeBwould be considered as inserted (because matching heirarchy is top to bottom).
