fix(multi-check)
gitea/salix/pipeline/head This commit looks good Details

This commit is contained in:
Alex Moreno 2022-05-13 12:14:37 +02:00
parent 558585fd15
commit 35209d77cc
4 changed files with 43 additions and 10 deletions

View File

@ -5,12 +5,14 @@
</vn-check> </vn-check>
<vn-icon-button <vn-icon-button
class="vn-pl-none" class="vn-pl-none"
ng-if="$ctrl.checked && $ctrl.checkDummyEnabled" ng-if="$ctrl.isCheckedDummy()"
icon="expand_more" icon="expand_more"
vn-popover="menu" vn-popover="menu"
ng-click="$ctrl.countRows()"> ng-click="$ctrl.countRows()">
</vn-icon-button> </vn-icon-button>
<vn-menu vn-id="menu"> <vn-menu
vn-id="menu"
ng-if="$ctrl.isCheckedDummy()">
<vn-list> <vn-list>
<span translate>All</span> <span translate>All</span>
<span class="bold"> <span class="bold">

View File

@ -172,6 +172,10 @@ export default class MultiCheck extends FormInput {
this.checkedDummyCount = this.allRowsCount; this.checkedDummyCount = this.allRowsCount;
} }
isCheckedDummy() {
return this.checked && this.checkDummyEnabled;
}
/** /**
* Toggles checked property on * Toggles checked property on
* all instances * all instances

View File

@ -190,4 +190,38 @@ describe('Component vnMultiCheck', () => {
expect(controller.checkedDummyCount).toBeNull(); expect(controller.checkedDummyCount).toBeNull();
}); });
}); });
describe('isCheckedDummy()', () => {
it(`should return true only if is checked and checked dummy is enabled`, () => {
controller.checked = true;
controller.checkDummyEnabled = true;
const isCheckedDummy = controller.isCheckedDummy();
expect(isCheckedDummy).toEqual(true);
});
it(`should return true only if is checked and checked dummy is enabled`, () => {
controller.checked = true;
controller.checkDummyEnabled = true;
const isCheckedDummy = controller.isCheckedDummy();
expect(isCheckedDummy).toEqual(true);
});
it(`should return false if not checked`, () => {
controller.checked = false;
controller.checkDummyEnabled = true;
const isCheckedDummy = controller.isCheckedDummy();
expect(isCheckedDummy).toEqual(false);
});
it(`should return false if checked dummy is disabled`, () => {
controller.checked = true;
controller.checkDummyEnabled = false;
const isCheckedDummy = controller.isCheckedDummy();
expect(isCheckedDummy).toEqual(false);
});
});
}); });

View File

@ -3,15 +3,8 @@ vn-multi-check {
.vn-check { .vn-check {
margin-bottom: 12px margin-bottom: 12px
} }
vn-list{
padding: 50px;
}
vn-menu{
padding: 50px;
} }
}
.bold{ .bold{
font-weight: bold; font-weight: bold;
} }