Skip to content

Commit f33bb3a

Browse files
committed
See if using padding instead of border stabilizes block widget spacing tests
1 parent 7cfb75e commit f33bb3a

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

test/webtest-draw-decoration.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ function decoEditor(doc: string, decorations: any = []) {
4242
return tempView(doc, decos(Decoration.set(decorations, true)))
4343
}
4444

45-
function near(a: number, b: number) { return Math.abs(a - b) < 1 }
45+
function near(a: number, b: number) { return Math.abs(a - b) < 0.1 }
4646

4747
describe("EditorView decoration", () => {
4848
it("renders tag names", () => {
@@ -931,7 +931,7 @@ describe("EditorView decoration", () => {
931931

932932
it("represents wrapper padding and borders as ghost widgets", () => {
933933
let cm = wrapEditor("a\nb\nc\nd", [
934-
BlockWrapper.create({tagName: "div", attributes: {style: "border: 2px solid blue; padding: 1px"}}).range(2, 5)
934+
BlockWrapper.create({tagName: "div", attributes: {style: "padding: 3px"}}).range(2, 5)
935935
])
936936
let eltTop = cm.elementAtHeight(cm.coordsAtPos(1)!.bottom + 2 - cm.documentTop)
937937
ist(eltTop.type, BlockType.WidgetRange)
@@ -951,9 +951,9 @@ describe("EditorView decoration", () => {
951951

952952
it("properly measures nested wrapper padding", () => {
953953
let cm = wrapEditor("a\nb\nc\nd", [
954-
BlockWrapper.create({tagName: "div", attributes: {style: "border: 2px solid blue"}}).range(2, 5),
955-
BlockWrapper.create({tagName: "div", attributes: {style: "border: 3px solid red"}}).range(2, 2),
956-
BlockWrapper.create({tagName: "div", attributes: {style: "border: 1px solid orange"}}).range(4, 4)
954+
BlockWrapper.create({tagName: "div", attributes: {style: "padding: 2px"}}).range(2, 5),
955+
BlockWrapper.create({tagName: "div", attributes: {style: "padding: 3px"}}).range(2, 2),
956+
BlockWrapper.create({tagName: "div", attributes: {style: "padding: 1px"}}).range(4, 4)
957957
])
958958
cm.measure()
959959
let gapAbove = (line: BlockInfo) => Array.isArray(line.type) ? line.type[0].height : 0

0 commit comments

Comments
 (0)