Relationship test
This commit is contained in:
@@ -4,7 +4,7 @@ class ComponentManager {
|
||||
constructor($rootScope, modelManager, syncManager, desktopManager, nativeExtManager, $timeout, $compile) {
|
||||
/* This domain will be used to save context item client data */
|
||||
ComponentManager.ClientDataDomain = "org.standardnotes.sn.components";
|
||||
|
||||
|
||||
this.$compile = $compile;
|
||||
this.$rootScope = $rootScope;
|
||||
this.modelManager = modelManager;
|
||||
@@ -882,7 +882,9 @@ class ComponentManager {
|
||||
var setSize = function(element, size) {
|
||||
var widthString = typeof size.width === 'string' ? size.width : `${data.width}px`;
|
||||
var heightString = typeof size.height === 'string' ? size.height : `${data.height}px`;
|
||||
element.setAttribute("style", `width:${widthString}; height:${heightString};`);
|
||||
if(element) {
|
||||
element.setAttribute("style", `width:${widthString}; height:${heightString};`);
|
||||
}
|
||||
}
|
||||
|
||||
if(component.area == "rooms" || component.area == "modal") {
|
||||
@@ -893,6 +895,9 @@ class ComponentManager {
|
||||
}
|
||||
} else {
|
||||
var iframe = this.iframeForComponent(component);
|
||||
if(!iframe) {
|
||||
return;
|
||||
}
|
||||
var width = data.width;
|
||||
var height = data.height;
|
||||
iframe.width = width;
|
||||
|
||||
3699
package-lock.json
generated
3699
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@@ -49,6 +49,28 @@ describe("notes and tags", () => {
|
||||
expect(note).to.be.an.instanceOf(SNNote);
|
||||
});
|
||||
|
||||
it.only('properly handles legacy relationships', () => {
|
||||
// legacy relationships are when a note has a reference to a tag
|
||||
let modelManager = Factory.createModelManager();
|
||||
let pair = createRelatedNoteTagPair();
|
||||
let noteParams = pair[0];
|
||||
let tagParams = pair[1];
|
||||
tagParams.content.references = null;
|
||||
noteParams.content.references = [
|
||||
{
|
||||
uuid: tagParams.uuid,
|
||||
content_type: tagParams.content_type
|
||||
}
|
||||
];
|
||||
|
||||
modelManager.mapResponseItemsToLocalModels([noteParams, tagParams]);
|
||||
let note = modelManager.allItemsMatchingTypes(["Note"])[0];
|
||||
let tag = modelManager.allItemsMatchingTypes(["Tag"])[0];
|
||||
|
||||
expect(note.tags.length).to.equal(1);
|
||||
expect(tag.notes.length).to.equal(1);
|
||||
})
|
||||
|
||||
it('creates two-way relationship between note and tag', () => {
|
||||
let modelManager = Factory.createModelManager();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user