Skip to content

Commit b59fe2a

Browse files
committed
style: match Binance panel divider
1 parent 510e820 commit b59fe2a

6 files changed

Lines changed: 33 additions & 7 deletions

File tree

‎e2e/binance-orderbook/specs/panel-visual-contract.pw.js‎

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,33 @@ async function expectVisualContract(page, name) {
1919
expect(`${JSON.stringify(contract, null, 2)}\n`).toMatchSnapshot(name);
2020
}
2121

22+
async function expectNativeDivider(page) {
23+
const divider = await page.locator(PANEL_SELECTOR).evaluate((panel) => {
24+
const panelRect = panel.getBoundingClientRect();
25+
const ladder = panel.querySelector('[data-panel-group="ladder"]');
26+
const ladderRect = ladder.getBoundingClientRect();
27+
const style = getComputedStyle(ladder);
28+
return {
29+
leftInset: ladderRect.left - panelRect.left,
30+
rightInset: panelRect.right - ladderRect.right,
31+
borderTopWidth: style.borderTopWidth,
32+
borderTopColor: style.borderTopColor,
33+
};
34+
});
35+
expect(divider).toEqual({
36+
leftInset: 1,
37+
rightInset: 1,
38+
borderTopWidth: '1px',
39+
borderTopColor: 'rgb(237, 237, 237)',
40+
});
41+
}
42+
2243
test('open panel matches the fixed visual contract', async ({ page }) => {
2344
await openUserscriptScenario(page, createCancelScenario({
2445
ui: { tradeMode: 'OPEN' },
2546
}));
2647
await expectPrecisionReady(page);
48+
await expectNativeDivider(page);
2749
await expectVisualContract(page, 'open-fixed.visual.json');
2850
});
2951

@@ -36,5 +58,6 @@ test('close panel matches the disabled-state visual contract', async ({ page })
3658
await expect(panel.getByRole('radio', { name: '平多' })).toBeEnabled();
3759
await expect(panel.getByRole('radio', { name: '平空' })).toBeDisabled();
3860
await expectPrecisionReady(page);
61+
await expectNativeDivider(page);
3962
await expectVisualContract(page, 'close-fixed.visual.json');
4063
});

‎e2e/binance-orderbook/specs/panel-visual-contract.pw.js-snapshots/close-fixed-visual.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
"ladder": {
2828
"rect": {
2929
"top": 135,
30-
"width": 292,
30+
"width": 312,
3131
"height": 263
3232
},
3333
"display": "block",

‎e2e/binance-orderbook/specs/panel-visual-contract.pw.js-snapshots/open-fixed-visual.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
"ladder": {
2828
"rect": {
2929
"top": 135,
30-
"width": 292,
30+
"width": 312,
3131
"height": 263
3232
},
3333
"display": "block",

‎scripts/binance-orderbook-trade.user.js‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
// @namespace binance.orderbook.trade
44
// @icon data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%2064%2064%22%3E%3Crect%20width%3D%2264%22%20height%3D%2264%22%20rx%3D%2214%22%20fill%3D%22%23f0b90b%22%2F%3E%3Ctext%20x%3D%2232%22%20y%3D%2249%22%20text-anchor%3D%22middle%22%20font-family%3D%22Arial%2C%20sans-serif%22%20font-size%3D%2242%22%20font-weight%3D%22800%22%20fill%3D%22%23111827%22%3EJ%3C%2Ftext%3E%3C%2Fsvg%3E
55
// @icon64 data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%2064%2064%22%3E%3Crect%20width%3D%2264%22%20height%3D%2264%22%20rx%3D%2214%22%20fill%3D%22%23f0b90b%22%2F%3E%3Ctext%20x%3D%2232%22%20y%3D%2249%22%20text-anchor%3D%22middle%22%20font-family%3D%22Arial%2C%20sans-serif%22%20font-size%3D%2242%22%20font-weight%3D%22800%22%20fill%3D%22%23111827%22%3EJ%3C%2Ftext%3E%3C%2Fsvg%3E
6-
// @version 2.7.122
6+
// @version 2.7.123
77
// @author jackhai9
88
// @description 单击订单簿价格,按当前开仓/平仓 tab 自动填数量并执行下单,内置数量倍率面板
99
// @match https://www.binance.com/*/futures/*
@@ -1864,6 +1864,7 @@
18641864
const PRIMARY_EMPHASIS_COLOR = "#000000";
18651865
const PRIMARY_EMPHASIS_FONT_WEIGHT = "500";
18661866
const CONTROL_BORDER_COLOR = "#d5d9e2";
1867+
const PANEL_DIVIDER_COLOR = "#ededed";
18671868
const CONTROL_BACKGROUND_COLOR = "#ffffff";
18681869
const CONTROL_TEXT_COLOR = "#5e6673";
18691870
const CONTROL_FONT_WEIGHT = "500";
@@ -5973,7 +5974,7 @@
59735974
"</div>",
59745975
"</div>",
59755976
"</div>",
5976-
'<div data-panel-group="ladder" style="margin-top:12px;padding-top:12px;border-top:1px solid #eef0f2;">',
5977+
`<div data-panel-group="ladder" style="margin:12px -10px 0;padding:12px 10px 0;border-top:1px solid ${PANEL_DIVIDER_COLOR};">`,
59775978
`<div title="${PANEL_COPY.tooltip.ladderMaker}" style="height:20px;color:${PRIMARY_EMPHASIS_COLOR};font-size:14px;font-weight:${PRIMARY_EMPHASIS_FONT_WEIGHT};line-height:20px;cursor:help;">${PANEL_COPY.section.ladderMaker}</div>`,
59785979
`<div id="${LADDER_BODY_ID}"></div>`,
59795980
`<div id="${LADDER_STATUS_ID}" title="空闲" style="height:18px;margin-top:6px;visibility:visible;color:${MUTED_TEXT_COLOR};font-size:13px;line-height:18px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;">空闲</div>`,

‎src/binance-orderbook-trade/index.user.js‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
// @namespace binance.orderbook.trade
44
// @icon data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%2064%2064%22%3E%3Crect%20width%3D%2264%22%20height%3D%2264%22%20rx%3D%2214%22%20fill%3D%22%23f0b90b%22%2F%3E%3Ctext%20x%3D%2232%22%20y%3D%2249%22%20text-anchor%3D%22middle%22%20font-family%3D%22Arial%2C%20sans-serif%22%20font-size%3D%2242%22%20font-weight%3D%22800%22%20fill%3D%22%23111827%22%3EJ%3C%2Ftext%3E%3C%2Fsvg%3E
55
// @icon64 data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%2064%2064%22%3E%3Crect%20width%3D%2264%22%20height%3D%2264%22%20rx%3D%2214%22%20fill%3D%22%23f0b90b%22%2F%3E%3Ctext%20x%3D%2232%22%20y%3D%2249%22%20text-anchor%3D%22middle%22%20font-family%3D%22Arial%2C%20sans-serif%22%20font-size%3D%2242%22%20font-weight%3D%22800%22%20fill%3D%22%23111827%22%3EJ%3C%2Ftext%3E%3C%2Fsvg%3E
6-
// @version 2.7.122
6+
// @version 2.7.123
77
// @author jackhai9
88
// @description 单击订单簿价格,按当前开仓/平仓 tab 自动填数量并执行下单,内置数量倍率面板
99
// @match https://www.binance.com/*/futures/*
@@ -302,6 +302,7 @@ import {
302302
const PRIMARY_EMPHASIS_COLOR = '#000000';
303303
const PRIMARY_EMPHASIS_FONT_WEIGHT = '500';
304304
const CONTROL_BORDER_COLOR = '#d5d9e2';
305+
const PANEL_DIVIDER_COLOR = '#ededed';
305306
const CONTROL_BACKGROUND_COLOR = '#ffffff';
306307
const CONTROL_TEXT_COLOR = '#5e6673';
307308
const CONTROL_FONT_WEIGHT = '500';
@@ -5197,7 +5198,7 @@ import {
51975198
'</div>',
51985199
'</div>',
51995200
'</div>',
5200-
'<div data-panel-group="ladder" style="margin-top:12px;padding-top:12px;border-top:1px solid #eef0f2;">',
5201+
`<div data-panel-group="ladder" style="margin:12px -10px 0;padding:12px 10px 0;border-top:1px solid ${PANEL_DIVIDER_COLOR};">`,
52015202
`<div title="${PANEL_COPY.tooltip.ladderMaker}" style="height:20px;color:${PRIMARY_EMPHASIS_COLOR};font-size:14px;font-weight:${PRIMARY_EMPHASIS_FONT_WEIGHT};line-height:20px;cursor:help;">${PANEL_COPY.section.ladderMaker}</div>`,
52025203
`<div id="${LADDER_BODY_ID}"></div>`,
52035204
`<div id="${LADDER_STATUS_ID}" title="空闲" style="height:18px;margin-top:6px;visibility:visible;color:${MUTED_TEXT_COLOR};font-size:13px;line-height:18px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;">空闲</div>`,

‎test/unit/binance-orderbook-trade/source-regressions.test.js‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -370,7 +370,8 @@ test('panel keeps controls in cohesive ordered semantic groups', () => {
370370
assert.ok(ladderIndex > quantityMinIndex);
371371
assert.match(ensurePanelBody, /data-panel-group="multiplier" style="margin-top:8px;"/);
372372
assert.match(precisionBody, /margin-top:10px;/);
373-
assert.match(ensurePanelBody, /data-panel-group="ladder" style="margin-top:12px;padding-top:12px;border-top:/);
373+
assert.match(source, /const PANEL_DIVIDER_COLOR = '#ededed'/);
374+
assert.match(ensurePanelBody, /data-panel-group="ladder" style="margin:12px -10px 0;padding:12px 10px 0;border-top:1px solid \$\{PANEL_DIVIDER_COLOR\}/);
374375
assert.match(ensurePanelBody, /PANEL_COPY\.section\.singleOrder/);
375376
assert.match(ensurePanelBody, /PANEL_COPY\.section\.ladderMaker/);
376377
assert.match(ladderPanelBody, /ORDERBOOK_PRECISION_RECOMMENDATION_ID/);

0 commit comments

Comments
 (0)