Skip to content

Commit

Permalink
Merge pull request #33 from cwrc/jest
Browse files Browse the repository at this point in the history
Replace old test framework with Jest
  • Loading branch information
ajmacdonald authored Aug 26, 2019
2 parents 5334fdf + ec945ce commit 7306f03
Show file tree
Hide file tree
Showing 10 changed files with 2,281 additions and 2,144 deletions.
3 changes: 3 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,10 @@ notifications:
email: false
node_js:
- '9'
script:
- npm run test
after_success:
- npm run report-coverage
- npm run travis-deploy-once "npm run semantic-release"
branches:
except:
Expand Down
2 changes: 0 additions & 2 deletions development.html
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,5 @@

<script type="text/javascript" src ="./build/development.js"></script>

<div id='file-save'> </div>

</body>
</html>
71 changes: 71 additions & 0 deletions development.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
'use strict';

let $ = require('jquery')
const Cookies = require('js-cookie')
let gitDialogs = require('../src/index.js')

const sampleDoc = `
<?xml version="1.0" encoding="UTF-8"?>
<?xml-model href="https://cwrc.ca/schemas/cwrc_tei_lite.rng" type="application/xml" schematypens="http://relaxng.org/ns/structure/1.0"?>
<?xml-stylesheet type="text/css" href="https://cwrc.ca/templates/css/tei.css"?>
<TEI xmlns="http://www.tei-c.org/ns/1.0" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:cw="http://cwrc.ca/ns/cw#" xmlns:w="http://cwrctc.artsrn.ualberta.ca/#">
<teiHeader>
<fileDesc>
<titleStmt>
<title>Sample Document Title</title>
</titleStmt>
<publicationStmt>
<p></p>
</publicationStmt>
<sourceDesc sameAs="http://www.cwrc.ca">
<p>Created from original research by members of CWRC/CSÉC unless otherwise noted.</p>
</sourceDesc>
</fileDesc>
</teiHeader>
<text>
<body>
<div>
Replace with your text.
</div>
</body>
</text>
</TEI>`;

let idCount = 0;
const writerMock = {
getUniqueId: (prefix) => {
let id = prefix+idCount;
idCount++;
return id;
},
dialogManager: {
getDialogWrapper: () => {
return $(document.body);
}
},
isDocLoaded: () => {
return false;
},
getDocument: (asString) => {
return sampleDoc;
},
setDocument: (doc) => {

},
event: (eventName) => {
return {
publish: () => {

}
}
}
}

$('#load-pop').on('click', function() {
gitDialogs.load(writerMock)

})

$('#save-pop').on('click', function() {
gitDialogs.save(writerMock)
})
Loading

0 comments on commit 7306f03

Please sign in to comment.