Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(plain-compare-list): swap list relations #1096

Merged
merged 2 commits into from
Nov 28, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 17 additions & 12 deletions src/plain-compare-list.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,7 @@ export class PlainCompareList extends LitElement {

render(): TemplateResult {
return html`
<div class="container">
<div class="flex"></div>
${this.renderFilterCheckbox()}
</div>
${this.renderFilterCheckbox()}
<div class="container container--alt">
<div class="list__container list__container--left">
<h3 class="mdc-dialog__title">${this.leftHandTitle}</h3>
Expand All @@ -83,8 +80,8 @@ export class PlainCompareList extends LitElement {
${this.leftHandObject && this.rightHandObject
? html`
${renderDiff(
this.leftHandObject,
this.rightHandObject,
this.leftHandObject,
this.filterMutables ? this.filterToIgnore : {}
)}
`
Expand All @@ -93,13 +90,21 @@ export class PlainCompareList extends LitElement {
}

protected renderFilterCheckbox(): TemplateResult {
return html`<mwc-formfield label="${translate('compare.filterMutables')}">
<mwc-checkbox
?checked=${this.filterMutables}
@change=${() => (this.filterMutables = !this.filterMutables)}
>
</mwc-checkbox>
</mwc-formfield> `;
if (this.filterToIgnore) {
return html`
<div class="container">
<div class="flex"></div>
<mwc-formfield label="${translate('compare.filterMutables')}">
<mwc-checkbox
?checked=${this.filterMutables}
@change=${() => (this.filterMutables = !this.filterMutables)}
>
</mwc-checkbox>
</mwc-formfield>
</div>
`;
}
return html``;
}

static styles = css`
Expand Down
30 changes: 3 additions & 27 deletions test/unit/__snapshots__/plain-compare-list.test.snap.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,7 @@
export const snapshots = {};

snapshots["Plain Compare List Empty list looks like the latest snapshot"] =
`<div class="container">
<div class="flex">
</div>
<mwc-formfield label="[compare.filterMutables]">
<mwc-checkbox checked="">
</mwc-checkbox>
</mwc-formfield>
</div>
<div class="container container--alt">
`<div class="container container--alt">
<div class="list__container list__container--left">
<h3 class="mdc-dialog__title">
</h3>
Expand All @@ -24,15 +16,7 @@ snapshots["Plain Compare List Empty list looks like the latest snapshot"] =
/* end snapshot Plain Compare List Empty list looks like the latest snapshot */

snapshots["Plain Compare List Basic List looks like the latest snapshot"] =
`<div class="container">
<div class="flex">
</div>
<mwc-formfield label="[compare.filterMutables]">
<mwc-checkbox checked="">
</mwc-checkbox>
</mwc-formfield>
</div>
<div class="container container--alt">
`<div class="container container--alt">
<div class="list__container list__container--left">
<h3 class="mdc-dialog__title">
Project doc
Expand All @@ -48,15 +32,7 @@ snapshots["Plain Compare List Basic List looks like the latest snapshot"] =
/* end snapshot Plain Compare List Basic List looks like the latest snapshot */

snapshots["Plain Compare List Basic List Has a subtitlte, so looks like the latest snapshot"] =
`<div class="container">
<div class="flex">
</div>
<mwc-formfield label="[compare.filterMutables]">
<mwc-checkbox checked="">
</mwc-checkbox>
</mwc-formfield>
</div>
<div class="container container--alt">
`<div class="container container--alt">
<div class="list__container list__container--left">
<h3 class="mdc-dialog__title">
Project doc
Expand Down