fix: use page scrolling for dragon tiger
This commit is contained in:
@@ -1400,25 +1400,31 @@ test("dragon-tiger redesign keeps the merged empty state and independent card hi
|
||||
await expect(page.locator("#stockDialog")).toBeVisible();
|
||||
await page.locator("#closeStockDialog").click();
|
||||
|
||||
await page.setViewportSize({ width: 1366, height: 768 });
|
||||
const scrollOwnership = await page.evaluate(() => {
|
||||
const body = document.querySelector("#dragonTraderDetail tbody");
|
||||
const seed = body.querySelector("tr");
|
||||
for (let index = 0; index < 20; index += 1) body.appendChild(seed.cloneNode(true));
|
||||
const main = document.querySelector(".app-main");
|
||||
const daily = document.querySelector("#dragonDailyContent");
|
||||
const operations = document.querySelector("#dragonTraderDetail .trader-operations");
|
||||
return {
|
||||
mainOverflow: getComputedStyle(main).overflowY,
|
||||
pageScrolls: main.scrollHeight > main.clientHeight,
|
||||
dailyOverflow: getComputedStyle(daily).overflowY,
|
||||
dailyFits: daily.scrollHeight <= daily.clientHeight + 1,
|
||||
operationOverflow: getComputedStyle(operations).overflowY,
|
||||
operationsScroll: operations.scrollHeight > operations.clientHeight,
|
||||
operationsFit: operations.scrollHeight <= operations.clientHeight + 1,
|
||||
descriptionSize: parseFloat(getComputedStyle(document.querySelector("#dragonTraderDetail .dragon-detail-header p")).fontSize),
|
||||
};
|
||||
});
|
||||
expect(scrollOwnership).toEqual({
|
||||
dailyOverflow: "hidden",
|
||||
mainOverflow: "auto",
|
||||
pageScrolls: true,
|
||||
dailyOverflow: "visible",
|
||||
dailyFits: true,
|
||||
operationOverflow: "auto",
|
||||
operationsScroll: true,
|
||||
operationsFit: true,
|
||||
descriptionSize: 13,
|
||||
});
|
||||
|
||||
|
||||
@@ -151,6 +151,106 @@ AUDITED_CSS_RETIREMENTS = {
|
||||
),
|
||||
}
|
||||
|
||||
# User-approved product behavior changes remain separate from code-retirement
|
||||
# records. Each entry is an exact source/replacement pair. Optional trailing
|
||||
# values declare the expected source count and how many leading occurrences to
|
||||
# transform when one identical occurrence must remain.
|
||||
AUDITED_CSS_REPLACEMENTS = {
|
||||
"redesign-v2.css": (
|
||||
(
|
||||
(
|
||||
'@media (min-width: 721px) {\n'
|
||||
' body[data-active-view="dragonView"] .app-main { display: flex; flex-direction: column; overflow: hidden; }\n'
|
||||
' body[data-active-view="dragonView"] .overview-strip { flex: 0 0 auto; }\n'
|
||||
' body[data-active-view="dragonView"] #dragonView.active-view {\n'
|
||||
' min-height: 0;\n'
|
||||
' flex: 1 1 auto;\n'
|
||||
' display: flex;\n'
|
||||
' flex-direction: column;\n'
|
||||
' }\n'
|
||||
' body[data-active-view="dragonView"] .dragon-page-head-v2 { flex: 0 0 auto; }\n'
|
||||
' body[data-active-view="dragonView"] .dragon-daily-content-v2,\n'
|
||||
' body[data-active-view="dragonView"] .dragon-empty-state-v2 { flex: 1 1 auto; }\n'
|
||||
'}\n'
|
||||
),
|
||||
(
|
||||
'@media (min-width: 721px) {\n'
|
||||
' body[data-active-view="dragonView"] .app-main { height: var(--workspace-height); min-height: 0; display: block; overflow: auto; }\n'
|
||||
' body[data-active-view="dragonView"] #dragonView.active-view {\n'
|
||||
' display: block;\n'
|
||||
' overflow: visible;\n'
|
||||
' }\n'
|
||||
'}\n'
|
||||
),
|
||||
),
|
||||
(
|
||||
(
|
||||
"/* The Dragon-Tiger page stays still; only the selected trader's operations scroll. */\n"
|
||||
'@media (min-width: 721px) {\n'
|
||||
' body[data-active-view="dragonView"] .dragon-daily-content-v2 {\n'
|
||||
' min-height: 0;\n'
|
||||
' display: grid;\n'
|
||||
' grid-template-rows: auto auto auto minmax(150px, 1fr) auto;\n'
|
||||
' overflow: hidden;\n'
|
||||
' }\n\n'
|
||||
' body[data-active-view="dragonView"] #dragonView .dragon-card-stage-v2 {\n'
|
||||
' flex: 0 0 auto;\n'
|
||||
' }\n\n'
|
||||
' body[data-active-view="dragonView"] #dragonView .dragon-trader-detail-v2 {\n'
|
||||
' min-height: 0;\n'
|
||||
' display: flex;\n'
|
||||
' flex-direction: column;\n'
|
||||
' }\n\n'
|
||||
' body[data-active-view="dragonView"] #dragonView .dragon-detail-header {\n'
|
||||
' flex: 0 0 auto;\n'
|
||||
' }\n\n'
|
||||
' body[data-active-view="dragonView"] #dragonView .dragon-trader-detail .trader-operations {\n'
|
||||
' min-height: 0;\n'
|
||||
' flex: 1 1 auto;\n'
|
||||
' overflow: auto;\n'
|
||||
' overscroll-behavior: contain;\n'
|
||||
' scrollbar-gutter: stable;\n'
|
||||
' }\n\n'
|
||||
' body[data-active-view="dragonView"] #dragonView .dragon-unclassified-v2 {\n'
|
||||
' max-height: 180px;\n'
|
||||
' overflow: auto;\n'
|
||||
' }\n'
|
||||
),
|
||||
(
|
||||
'/* The Dragon-Tiger page owns vertical scrolling; wide operation tables scroll horizontally. */\n'
|
||||
'@media (min-width: 721px) {\n'
|
||||
' body[data-active-view="dragonView"] .dragon-daily-content-v2 {\n'
|
||||
' display: block;\n'
|
||||
' overflow: visible;\n'
|
||||
' }\n\n'
|
||||
' body[data-active-view="dragonView"] #dragonView .dragon-trader-detail-v2 {\n'
|
||||
' display: block;\n'
|
||||
' }\n\n'
|
||||
' body[data-active-view="dragonView"] #dragonView .dragon-trader-detail .trader-operations {\n'
|
||||
' max-height: none;\n'
|
||||
' overflow: auto;\n'
|
||||
' }\n\n'
|
||||
' body[data-active-view="dragonView"] #dragonView .dragon-unclassified-v2 {\n'
|
||||
' max-height: none;\n'
|
||||
' overflow: visible;\n'
|
||||
' }\n'
|
||||
),
|
||||
),
|
||||
),
|
||||
"design-system.css": (
|
||||
(' [data-active-view="dragonView"],\n', "", 4, 3),
|
||||
(' #dragonView.active-view,\n', ""),
|
||||
(' #dragonView .dragon-page-head-v2,\n', ""),
|
||||
(' #dragonView .dragon-daily-content-v2,\n', ""),
|
||||
(
|
||||
' #dragonView .dragon-daily-content-v2{overflow:hidden}\n'
|
||||
' #dragonView .dragon-trader-detail-v2{min-height:0}\n'
|
||||
' #dragonView .dragon-trader-detail .trader-operations{min-height:0;overflow:auto}\n\n',
|
||||
"",
|
||||
),
|
||||
),
|
||||
}
|
||||
|
||||
|
||||
def sha256(path: Path) -> str:
|
||||
return hashlib.sha256(path.read_bytes()).hexdigest()
|
||||
@@ -245,12 +345,21 @@ def assert_moved_asset_matches(
|
||||
frontend_relative: str | None = None,
|
||||
) -> None:
|
||||
target_relative = frontend_relative or original_relative
|
||||
if original_relative in AUDITED_CSS_RETIREMENTS:
|
||||
if (
|
||||
original_relative in AUDITED_CSS_RETIREMENTS
|
||||
or original_relative in AUDITED_CSS_REPLACEMENTS
|
||||
):
|
||||
original = (ORIGINAL_STATIC / original_relative).read_text(encoding="utf-8")
|
||||
for retired in AUDITED_CSS_RETIREMENTS[original_relative]:
|
||||
for retired in AUDITED_CSS_RETIREMENTS.get(original_relative, ()):
|
||||
source, replacement = retired if isinstance(retired, tuple) else (retired, "")
|
||||
testcase.assertEqual(original.count(source), 1, source)
|
||||
original = original.replace(source, replacement, 1)
|
||||
for replacement in AUDITED_CSS_REPLACEMENTS.get(original_relative, ()):
|
||||
source, target, *count_override = replacement
|
||||
expected_count = count_override[0] if count_override else 1
|
||||
replacement_count = count_override[1] if len(count_override) > 1 else expected_count
|
||||
testcase.assertEqual(original.count(source), expected_count, source)
|
||||
original = original.replace(source, target, replacement_count)
|
||||
testcase.assertEqual(
|
||||
(FRONTEND_ROOT / target_relative).read_text(encoding="utf-8"),
|
||||
original,
|
||||
|
||||
Reference in New Issue
Block a user