Skip to content

Commit

Permalink
Merge
Browse files Browse the repository at this point in the history
  • Loading branch information
klembot committed Dec 20, 2017
2 parents d8baded + 46d1ca5 commit ad3fe26
Show file tree
Hide file tree
Showing 6 changed files with 38 additions and 6 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "Twine",
"version": "2.2.0",
"version": "2.2.1",
"author": "Chris Klimas <chris@twinery.org>",
"description": "a GUI for creating nonlinear stories",
"license": "GPL-3.0",
Expand Down
9 changes: 6 additions & 3 deletions src/data/actions/story.js
Original file line number Diff line number Diff line change
Expand Up @@ -136,18 +136,21 @@ const actions = module.exports = {
story.storyFormatVersion
).major;

/* eslint-disable max-len */

if (latestVersions[story.storyFormat] &&
latestVersions[story.storyFormat][majorVersion]) {
latestVersions[story.storyFormat][majorVersion] &&
story.storyFormatVersion !== latestVersions[story.storyFormat][majorVersion].version) {
actions.updateStory(
store,
story.id,
{
/* eslint-disable max-len */
storyFormatVersion: latestVersions[story.storyFormat][majorVersion].version
/* eslint-enable max-len */
}
);
}

/* eslint-enable max-len */
}
else if (latestVersions[story.storyFormat]) {
/*
Expand Down
26 changes: 26 additions & 0 deletions src/data/actions/story.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,32 @@ describe('story actions module', () => {
)).to.be.true;
});

it('leaves story format versions alone if the story is already up-to-date', () => {
let storiesStore = {
dispatch: spy(),
state: {
storyFormat: {
formats: [
{ name: 'Default Format', version: '1.2.3' },
{ name: 'Default Format', version: '1.2.5' }
]
},
story: {
stories: [
{
id: 'not-a-real-id',
storyFormat: 'Default Format',
storyFormatVersion: '1.2.5'
}
]
}
}
};

actions.repairStories(storiesStore);
expect(storiesStore.dispatch.notCalled).to.be.true;
});

it('leaves stories alone if their story format does not exist', () => {
let storiesStore = {
dispatch: spy(),
Expand Down
2 changes: 1 addition & 1 deletion src/data/publish.js
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ const publish = module.exports = {
});

const tagData = Object.keys(story.tagColors).map(tag =>
`<tw-tag name="${escape(tag)}" color="${escape(story.tagColors[tag])}" />`
`<tw-tag name="${escape(tag)}" color="${escape(story.tagColors[tag])}"></tw-tag>`
);

return `<tw-storydata name="${escape(story.name)}" ` +
Expand Down
3 changes: 3 additions & 0 deletions src/data/publish.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,9 @@ describe('publish module', () => {
expect($tags.length).to.equal(1);
expect($($tags[0]).attr('name')).to.equal('test-tag');
expect($($tags[0]).attr('color')).to.equal('red');

const $passages = $el.children('tw-passagedata');
expect($passages.length).to.equal(2);
};

it('publishes a passage to HTML with publishPassage()', () => {
Expand Down
2 changes: 1 addition & 1 deletion src/file/save.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ require('blob-polyfill');

module.exports = (data, filename, success, failure) => {
try {
if (oniOS()) {
if (!oniOS()) {
// standard style

const blob = new Blob([data], { type: 'text/html;charset=utf-8' });
Expand Down

0 comments on commit ad3fe26

Please sign in to comment.