Merge pull request '4037-fix(multi-check)' (#973) from 4037-multi-check_align into dev
gitea/salix/pipeline/head This commit looks good Details

Reviewed-on: #973
Reviewed-by: Carlos Jimenez Ruiz <carlosjr@verdnatura.es>
This commit is contained in:
Carlos Jimenez Ruiz 2022-05-16 08:35:54 +00:00
commit d7c790de4f
4 changed files with 35 additions and 10 deletions

View File

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

View File

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

View File

@ -190,4 +190,30 @@ describe('Component vnMultiCheck', () => {
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`, () => {
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 {
margin-bottom: 12px
}
vn-list{
padding: 50px;
}
vn-menu{
padding: 50px;
}
}
.bold{
font-weight: bold;
}