Skip to content

Commit

Permalink
Fix visual bug when inserting new block at the top
Browse files Browse the repository at this point in the history
  • Loading branch information
heyman committed Jan 1, 2024
1 parent 870857b commit 9ff7742
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
3 changes: 1 addition & 2 deletions src/editor/block/block.js
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,7 @@ class NoteBlockStart extends WidgetType {
this.isFirst = isFirst
}
eq(other) {
//return other.checked == this.checked
return true
return this.isFirst === other.isFirst
}
toDOM() {
let wrap = document.createElement("div")
Expand Down
6 changes: 5 additions & 1 deletion tests/block-creation.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,12 @@ Block A
Block B
∞∞∞text
Block C`)
await page.waitForTimeout(100);
// check that blocks are created
expect((await heynotePage.getBlocks()).length).toBe(3)

// check that visual block layers are created
expect(await page.locator("css=.heynote-blocks-layer > div").count()).toBe(3)
expect(await page.locator("css=.heynote-blocks-layer > div")).toHaveCount(3)

// select the second block
await page.locator("body").press("ArrowUp")
Expand Down Expand Up @@ -56,5 +57,8 @@ const runTest = async (page, key, expectedBlocks) => {
const index = expectedBlocks.indexOf(expectedBlock);
expect(await heynotePage.getBlockContent(index)).toBe(`Block ${expectedBlock}`)
}

// check that only one block delimiter widget has the class first
expect(await page.locator("css=.heynote-block-start.first")).toHaveCount(1)
}

0 comments on commit 9ff7742

Please sign in to comment.