mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-19 17:52:21 +00:00
Vue kit: compact styles the action variant only, tone is accent or danger, a disabled icon button dims; pin the inherited type
Co-authored-by: Manjunath Paparaju <[email protected]>
This commit is contained in:
1 parent
4114ea1a05
commit
0d3c3325d4
7 files changed
+87
-27
No files matched your search
@@ -17,7 +17,15 @@ function rules(source) {
|
||||
const prelude = match[1].split('}').pop().trim();
|
||||
if (prelude.startsWith('@')) continue;
|
||||
out.push({
|
||||
selectors: prelude.split(',').map((s) => s.replace(/\s+/g, ' ').trim()),
|
||||
selectors: prelude
|
||||
.split(',')
|
||||
.map((s) =>
|
||||
s
|
||||
.replace(/\s+/g, ' ')
|
||||
.replace(/\( /g, '(')
|
||||
.replace(/ \)/g, ')')
|
||||
.trim(),
|
||||
),
|
||||
body: match[2],
|
||||
});
|
||||
}
|
||||
@@ -55,13 +63,21 @@ test('UiButton variants wear Core’s action and icon skins', () => {
|
||||
'.ui-button--primary:where(:not(:disabled))',
|
||||
'#scene-panel .scene-btn-primary:not(:disabled)',
|
||||
);
|
||||
shares('.ui-button--compact', '.gev-action-button--compact');
|
||||
shares(
|
||||
'.ui-button--compact.ui-button--danger:hover:not(:disabled)',
|
||||
'.ui-button--compact:where(.ui-button--action)',
|
||||
'.gev-action-button--compact',
|
||||
);
|
||||
shares(
|
||||
'.ui-button--compact:where(.ui-button--action):hover:not(:disabled):not(.ui-button--pressed)',
|
||||
'.gev-action-button--compact:hover:not(:disabled)',
|
||||
);
|
||||
shares(
|
||||
'.ui-button--compact.ui-button--danger:where(.ui-button--action):hover:not(:disabled)',
|
||||
'.gev-action-button--compact.gev-action-button--danger:hover:not(:disabled)',
|
||||
);
|
||||
shares('.ui-button--icon', '.panel-collapse-btn');
|
||||
shares('.ui-button--icon:hover', '.panel-collapse-btn:hover');
|
||||
shares('.ui-button--icon:hover:not(:disabled)', '.panel-collapse-btn:hover');
|
||||
assert.match(ruleWith('.ui-button--icon:disabled').body, /opacity:\s*0\.45/);
|
||||
});
|
||||
|
||||
test('a pressed styled button looks as a hovered one does', () => {
|
||||
@@ -77,13 +93,17 @@ test('a pressed styled button looks as a hovered one does', () => {
|
||||
'.ui-button--action.ui-button--danger.ui-button--pressed:not(:disabled)',
|
||||
'.gev-action-button--danger:hover:not(:disabled)',
|
||||
);
|
||||
shares('.ui-button--icon.ui-button--pressed', '.panel-collapse-btn:hover');
|
||||
shares(
|
||||
'.ui-button--icon.ui-button--pressed:not(:disabled)',
|
||||
'.panel-collapse-btn:hover',
|
||||
);
|
||||
});
|
||||
|
||||
test('a ghost button and the tones alone carry no style', () => {
|
||||
test('a ghost button, the tones and the size alone carry no style', () => {
|
||||
const kitButton =
|
||||
/\.ui-button(?:--(?:ghost|accent|danger|alert|pressed))?(?![\w-])/;
|
||||
const look = /\.ui-button--(?:action|primary|icon|compact)(?![\w-])/;
|
||||
/\.ui-button(?:--(?:ghost|accent|danger|pressed|compact))?(?![\w-])/;
|
||||
// size="compact" styles the action variant only.
|
||||
const look = /\.ui-button--(?:action|primary|icon)(?![\w-])/;
|
||||
for (const rule of all)
|
||||
for (const selector of rule.selectors)
|
||||
assert.ok(
|
||||
@@ -133,3 +153,20 @@ test('the kit’s skins load before the feature stylesheets that restyle them',
|
||||
);
|
||||
}
|
||||
});
|
||||
|
||||
test('feature rules over a kit skin keep the type they inherit', () => {
|
||||
// The chip and empty skins set a font and colour; these feature surfaces
|
||||
// inherit theirs from the card or strip around them.
|
||||
for (const [selector, property] of [
|
||||
['.gev-voice-card-chip', /font:\s*inherit/],
|
||||
['.scene-shot-empty', /font:\s*inherit/],
|
||||
['.recent-imagery-readout .ri-strip-empty', /font:\s*inherit/],
|
||||
['.recent-imagery-readout .ri-strip-empty', /color:\s*inherit/],
|
||||
])
|
||||
assert.ok(
|
||||
all.some(
|
||||
(rule) => rule.selectors.includes(selector) && property.test(rule.body),
|
||||
),
|
||||
`${selector} keeps ${property}`,
|
||||
);
|
||||
});
|
||||
Reference in new issue
Block a user