Skip to content

Commit

Permalink
feat(list): Added test harnesses to list
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 464762613
  • Loading branch information
material-web-copybara authored and copybara-github committed Aug 2, 2022
1 parent 89e8ff9 commit bf29bc3
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 31 deletions.
8 changes: 8 additions & 0 deletions list/harness.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,14 @@ import {ListItemHarness} from './lib/listitem/harness';
* Test harness for list.
*/
export class ListHarness extends Harness<List> {
/**
* Returns the first list item element.
*/
protected override async getInteractiveElement() {
await this.element.updateComplete;
return (await this.getItems())[0].getInteractiveElement();
}

/** @return List item harnesses. */
getItems() {
return this.element.items.map((item) => new ListItemHarness(item));
Expand Down
37 changes: 6 additions & 31 deletions list/lib/_list-theme.scss
Original file line number Diff line number Diff line change
Expand Up @@ -3,50 +3,25 @@
// SPDX-License-Identifier: Apache-2.0
//

// TODO(b/228217731): Remove MDC/MWC dependencies
@use 'sass:map';
@use '@material/web/compat/theme/state';
@use '@material/web/sass/resolvers';
@use '@material/web/sass/theme';

$selectors: (
disabled: '.md3-list--disabled',
);
@use './tokens';

$light-theme: (
color: unset,
container-color:
map.get(tokens.md-comp-list-values(), list-item-container-color),
);

@function _resolve-theme($theme, $resolvers) {
@return $theme;
}

@mixin theme($theme, $resolvers: resolvers.$material) {
@mixin theme($theme) {
$theme: theme.validate-theme($light-theme, $theme);
$theme: _resolve-theme($theme, $resolvers);
$theme: theme.create-theme-vars($theme, list);

@include theme.emit-theme-vars($theme);
}

@mixin theme-styles($theme, $resolvers: resolvers.$material) {
@mixin theme-styles($theme) {
$theme: theme.validate-theme-styles($light-theme, $theme);
$theme: _resolve-theme($theme, $resolvers);
$theme: theme.create-theme-vars($theme, list);

@include _colors(
(
default: map.get($theme, color),
)
);
}

@mixin _colors($colors) {
@include state.enabled($selectors) {
@include _set-color(state.get-default-state($colors));
}
}

@mixin _set-color($color) {
color: $color;
background-color: map.get($theme, container-color);
}
13 changes: 13 additions & 0 deletions list/test/window_size.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"capabilities": {
"goog:chromeOptions": {
"args": [
"--window-position=0,0",
"--window-size=1920,1200"
]
}
},
"extension": {
"xvfbResolution": "1920x1200x24"
}
}

0 comments on commit bf29bc3

Please sign in to comment.