Skip to content

Commit

Permalink
fix(plain-compare-list): swap list relations (#1096)
Browse files Browse the repository at this point in the history
Signed-off-by: Pascal Wilbrink <pascal.wilbrink@alliander.com>

Signed-off-by: Pascal Wilbrink <pascal.wilbrink@alliander.com>
  • Loading branch information
pascalwilbrink committed Nov 28, 2022
1 parent 95ba5ab commit 9fbfbcd
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 39 deletions.
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

0 comments on commit 9fbfbcd

Please sign in to comment.