mirror of
https://github.com/zadam/trilium.git
synced 2025-11-03 11:56:01 +01:00
tests for note properties
This commit is contained in:
@@ -10,6 +10,20 @@ class Note {
|
||||
this.noteId = row.noteId;
|
||||
/** @param {string} */
|
||||
this.title = row.title;
|
||||
/** @param {string} */
|
||||
this.type = row.type;
|
||||
/** @param {string} */
|
||||
this.mime = row.mime;
|
||||
/** @param {number} */
|
||||
this.contentLength = row.contentLength;
|
||||
/** @param {string} */
|
||||
this.dateCreated = row.dateCreated;
|
||||
/** @param {string} */
|
||||
this.dateModified = row.dateModified;
|
||||
/** @param {string} */
|
||||
this.utcDateCreated = row.utcDateCreated;
|
||||
/** @param {string} */
|
||||
this.utcDateModified = row.utcDateModified;
|
||||
/** @param {boolean} */
|
||||
this.isProtected = !!row.isProtected;
|
||||
/** @param {boolean} */
|
||||
@@ -224,6 +238,26 @@ class Note {
|
||||
return arr.flat();
|
||||
}
|
||||
|
||||
get parentCount() {
|
||||
return this.parents.length;
|
||||
}
|
||||
|
||||
get childrenCount() {
|
||||
return this.children.length;
|
||||
}
|
||||
|
||||
get labelCount() {
|
||||
return this.attributes.filter(attr => attr.type === 'label').length;
|
||||
}
|
||||
|
||||
get relationCount() {
|
||||
return this.attributes.filter(attr => attr.type === 'relation').length;
|
||||
}
|
||||
|
||||
get attributeCount() {
|
||||
return this.attributes.length;
|
||||
}
|
||||
|
||||
/** @return {Note[]} - returns only notes which are templated, does not include their subtrees
|
||||
* in effect returns notes which are influenced by note's non-inheritable attributes */
|
||||
get templatedNotes() {
|
||||
|
||||
Reference in New Issue
Block a user