Add '#' to default annotation color

And add test
This commit is contained in:
Dan Stillman 2023-04-09 17:03:50 -04:00
parent ce16a28f4a
commit 1d6cae08d2
2 changed files with 17 additions and 1 deletions

View file

@ -33,7 +33,7 @@ Zotero.Annotations = new function () {
Zotero.defineProperty(this, 'ANNOTATION_TYPE_IMAGE', { value: 3 });
Zotero.defineProperty(this, 'ANNOTATION_TYPE_INK', { value: 4 });
Zotero.defineProperty(this, 'DEFAULT_COLOR', { value: 'ffd400' });
Zotero.defineProperty(this, 'DEFAULT_COLOR', { value: '#ffd400' });
Zotero.defineProperty(this, 'PROPS', {
value: ['type', 'authorName', 'text', 'comment', 'color', 'pageLabel', 'sortIndex', 'position'],

View file

@ -1400,6 +1400,22 @@ describe("Zotero.Item", function () {
assert.isFalse(annotation.hasChanged());
});
it("should assign a default color", async function () {
var annotation = new Zotero.Item('annotation');
annotation.parentID = attachment.id;
annotation.annotationType = 'highlight';
annotation.annotationText = "This is highlighted text.";
annotation.annotationSortIndex = '00015|002431|00000';
annotation.annotationPosition = JSON.stringify({
pageIndex: 123,
rects: [
[314.4, 412.8, 556.2, 609.6]
]
});
await annotation.saveTx();
assert.equal(annotation.annotationColor, '#ffd400');
});
it("should save a note annotation", async function () {
var annotation = new Zotero.Item('annotation');
annotation.parentID = attachment.id;