4037-fix(multi-check) #973

Merged
carlosjr merged 4 commits from 4037-multi-check_align into dev 2022-05-16 08:35:57 +00:00
4 changed files with 35 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,30 @@ 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 false if not checked`, () => {
alexm marked this conversation as resolved
Review

Tested twice?

Tested twice?
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;
} }