mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-19 17:52:21 +00:00
Vue kit: UiCheckbox for the Visual, voice, Data Library and welcome checkboxes
UiCheckbox is a label wrapping a native checkbox and its words; trailing puts the box after them, as the Visual panel's rows have it. v-model shows the value and emits the checked state, and change is emitted with its event; without a modelValue the box is the browser's own, as the welcome card's "Don't show this again" is. restore puts the box back to modelValue once a change has rendered without the owner taking it, which is what the voice panel's v-checked directive did for a refused preference. Attributes go to the label; inputId and inputAttrs to the box. checkbox.css holds the centred flex row, moved out of the two labels that hold only a checkbox (first-run.css, library.css) and loaded before them. Each box keeps its skin's size, margin and accent colour. checkboxes.test.mjs fails if a view writes a checkbox by hand; Story Explore's filters are not converted yet. Co-authored-by: Manjunath Paparaju <[email protected]>
This commit is contained in:
1 parent
52dd576769
commit
2d7b7be890
18 files changed
+385
-41
No files matched your search
@@ -188,6 +188,31 @@ test('UiSearchField owns the row and bare input both search skins drew', () => {
|
||||
}
|
||||
});
|
||||
|
||||
test('UiCheckbox owns the centred row the checkbox-only labels drew', () => {
|
||||
const label = ruleWith('.ui-checkbox');
|
||||
assert.deepEqual(label.selectors, ['.ui-checkbox']);
|
||||
assert.match(label.body, /display:\s*flex;/);
|
||||
assert.match(label.body, /align-items:\s*center;/);
|
||||
// The box keeps each skin's size, margin and accent colour.
|
||||
assert.ok(
|
||||
!all.some((rule) =>
|
||||
rule.selectors.some((s) => s.startsWith('.ui-checkbox__input')),
|
||||
),
|
||||
);
|
||||
// Labels that hold only a checkbox leave the row to the kit; the Visual
|
||||
// and voice rows share their classes with buttons and other labels, so
|
||||
// theirs stay.
|
||||
for (const selector of ['.first-run-suppress', '.data-library-check']) {
|
||||
const feature = ruleWith(selector);
|
||||
for (const property of ['display', 'align-items'])
|
||||
assert.doesNotMatch(
|
||||
feature.body,
|
||||
new RegExp(`(^|[\\s;])${property}:`),
|
||||
`${selector} leaves ${property} to the kit`,
|
||||
);
|
||||
}
|
||||
});
|
||||
|
||||
test('the kit’s skins load before the feature stylesheets that restyle them', () => {
|
||||
const at = (selector) => css.indexOf(selector);
|
||||
for (const [kit, feature] of [
|
||||
@@ -209,6 +234,10 @@ test('the kit’s skins load before the feature stylesheets that restyle them',
|
||||
['.ui-search-field {', '.layer-finder__field {'],
|
||||
['.ui-search-field__input {', '.context-search__input {'],
|
||||
['.ui-search-field__input {', '.layer-finder__field input {'],
|
||||
['.ui-checkbox {', '.pp-toggle-btn {'],
|
||||
['.ui-checkbox {', '.gev-voice-preference {'],
|
||||
['.ui-checkbox {', '.data-library-check {'],
|
||||
['.ui-checkbox {', '.first-run-suppress {'],
|
||||
]) {
|
||||
assert.ok(
|
||||
at(kit) >= 0 && at(feature) > at(kit),
|
||||
|
||||
Reference in new issue
Block a user