SFJS 0.3.54, fixes content merging issue

This commit is contained in:
Mo Bitar
2019-03-28 10:52:24 -05:00
parent 5f953b41f8
commit 4b76c2a247
3 changed files with 36 additions and 5 deletions

6
package-lock.json generated
View File

@@ -4830,9 +4830,9 @@
"dev": true "dev": true
}, },
"standard-file-js": { "standard-file-js": {
"version": "0.3.53", "version": "0.3.54",
"resolved": "https://registry.npmjs.org/standard-file-js/-/standard-file-js-0.3.53.tgz", "resolved": "https://registry.npmjs.org/standard-file-js/-/standard-file-js-0.3.54.tgz",
"integrity": "sha512-BU8oxx8RuKMulU5byYZamZiOnxRQrSRCC7EgQyO6+XfOsdPEHBrMxgosd6HAP3l72A+lPY7YHxUOt9oFcdYoxQ==", "integrity": "sha512-M7d4J83iZ7VzsmzrwvO7N3R3Jr6hmdvJinWLEi4emwKgqZCc8ExIxBVe3TyrlQbC57cAGDqP/qK7Iu3S0bflIg==",
"dev": true "dev": true
}, },
"statuses": { "statuses": {

View File

@@ -38,7 +38,7 @@
"serve-static": "^1.13.2", "serve-static": "^1.13.2",
"sn-models": "0.1.14", "sn-models": "0.1.14",
"sn-stylekit": "2.0.13", "sn-stylekit": "2.0.13",
"standard-file-js": "0.3.53", "standard-file-js": "0.3.54",
"grunt-shell": "^2.1.0" "grunt-shell": "^2.1.0"
} }
} }

View File

@@ -49,6 +49,24 @@ describe("notes and tags", () => {
expect(note).to.be.an.instanceOf(SNNote); expect(note).to.be.an.instanceOf(SNNote);
}); });
it('properly constructs syncing params', () => {
let note = new SNNote();
let title = "Foo", text = "Bar";
note.title = title;
note.text = text;
let content = note.createContentJSONFromProperties();
expect(content.title).to.equal(title);
expect(content.text).to.equal(text);
let tag = new SNTag();
tag.title = title;
expect(tag.createContentJSONFromProperties().title).to.equal(title);
expect(tag.structureParams().title).to.equal(tag.getContentCopy().title);
})
it('properly handles legacy relationships', () => { it('properly handles legacy relationships', () => {
// legacy relationships are when a note has a reference to a tag // legacy relationships are when a note has a reference to a tag
let modelManager = Factory.createModelManager(); let modelManager = Factory.createModelManager();
@@ -409,7 +427,7 @@ describe("notes and tags", () => {
expect(tag.content.references.length).to.equal(0); expect(tag.content.references.length).to.equal(0);
}); });
it.only('deleting a tag should not dirty notes', () => { it('deleting a tag should not dirty notes', () => {
// Tags now reference notes, but it used to be that tags referenced notes and notes referenced tags. // Tags now reference notes, but it used to be that tags referenced notes and notes referenced tags.
// After the change, there was an issue where removing an old tag relationship from a note would only // After the change, there was an issue where removing an old tag relationship from a note would only
// remove one way, and thus keep it intact on the visual level. // remove one way, and thus keep it intact on the visual level.
@@ -464,6 +482,19 @@ describe("syncing", () => {
}) })
} }
it.only('syncing a note should collapse its properties into the content object after sync', async () => {
let note = new SNNote();
note.title = "Foo";
note.setDirty(true);
modelManager.addItem(note);
expect(note.content.title).to.not.be.ok;
await syncManager.sync();
expect(note.content.title).to.equal("Foo");
});
it('syncing a note many times does not cause duplication', async () => { it('syncing a note many times does not cause duplication', async () => {
modelManager.handleSignout(); modelManager.handleSignout();
let pair = createRelatedNoteTagPair(); let pair = createRelatedNoteTagPair();