Skip to content

Commit

Permalink
fix: selection button styling and unittests
Browse files Browse the repository at this point in the history
  • Loading branch information
Jelmer Veen committed Dec 7, 2021
1 parent 9394efa commit 294041e
Show file tree
Hide file tree
Showing 5 changed files with 78 additions and 5 deletions.
4 changes: 2 additions & 2 deletions src/components/buttons/CollectionSelectAll.vue
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@
:checked="allCollectionsSelected"
hidden/>
<label class="add-to-cart-label btn btn-outline-secondary" for="select-deselect-all">
<span class="mr-2">Select all collections</span>
<span>Select all collections</span>
</label>
<label class="remove-from-cart-label btn btn-outline-danger" for="select-deselect-all">
<span class="mr-2">Deselect all collections</span>
<span>Deselect all collections</span>
</label>
</div>
</template>
Expand Down
4 changes: 2 additions & 2 deletions src/components/buttons/CollectionSelector.vue
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
:value="false"
hidden/>
<label v-if="!iconOnly" class="add-to-cart-label btn btn-outline-secondary" :for="checkboxIdentifier">
<span class="mr-2">Add to selection</span>
<span>Add to selection</span>
</label>
<label v-else class="add-to-cart-label btn" :for="checkboxIdentifier">
<font-awesome-icon
Expand All @@ -22,7 +22,7 @@
v-if="!iconOnly"
class="btn remove-from-cart-label btn-outline-danger"
:for="checkboxIdentifier">
<span class="mr-2">Remove from selection</span>
<span>Remove from selection</span>
</label>
<label
v-else
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,10 @@ describe('Generator view-components', () => {
// remove whitespace and newlines for easy check
const flattendHtml = wrapper.html().replace(/\s/gmi, '')

expect(flattendHtml).toBe('<tr><thscope="row"class="pr-1align-top">Count:</th><td><spanclass="m-1badgebadge-info">1</span><spanclass="m-1badgebadge-info">2</span><spanclass="m-1badgebadge-info">3</span></td></tr>')
expect(flattendHtml.includes('>Count:<')).toBeTruthy()
expect(flattendHtml.includes('>1<')).toBeTruthy()
expect(flattendHtml.includes('>2<')).toBeTruthy()
expect(flattendHtml.includes('>3<')).toBeTruthy()
})

it('can create a tr with badges for a categorical mref attribute object with id/label/name and a uri', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,16 @@ const expected = {
type: 'int',
value: ''
},
{
label: 'Donor size:',
type: 'object',
value: ''
},
{
label: 'Donors:',
type: 'int',
value: ''
},
{
label: 'Age:',
type: 'range',
Expand Down Expand Up @@ -183,6 +193,16 @@ const expected = {
type: 'int',
value: ''
},
{
label: 'Donor size:',
type: 'object',
value: ''
},
{
label: 'Donors:',
type: 'int',
value: ''
},
{
label: 'Age:',
type: 'range',
Expand Down Expand Up @@ -254,6 +274,16 @@ const expected = {
type: 'int',
value: ''
},
{
label: 'Donor size:',
type: 'object',
value: ''
},
{
label: 'Donors:',
type: 'int',
value: ''
},
{
label: 'Age:',
type: 'range',
Expand Down
40 changes: 40 additions & 0 deletions tests/unit/specs/utils/templateMapper.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -288,6 +288,16 @@ describe('templateMapper', () => {
type: 'int',
value: ''
},
{
label: 'Donor size:',
type: 'object',
value: ''
},
{
label: 'Donors:',
type: 'int',
value: ''
},
{
label: 'Age:',
type: 'range',
Expand Down Expand Up @@ -427,6 +437,16 @@ describe('templateMapper', () => {
type: 'int',
value: ''
},
{
label: 'Donor size:',
type: 'object',
value: ''
},
{
label: 'Donors:',
type: 'int',
value: ''
},
{
label: 'Age:',
type: 'range',
Expand Down Expand Up @@ -495,6 +515,16 @@ describe('templateMapper', () => {
type: 'int',
value: ''
},
{
label: 'Donor size:',
type: 'object',
value: ''
},
{
label: 'Donors:',
type: 'int',
value: ''
},
{
label: 'Age:',
type: 'range',
Expand Down Expand Up @@ -574,6 +604,16 @@ describe('templateMapper', () => {
type: 'int',
value: ''
},
{
label: 'Donor size:',
type: 'object',
value: ''
},
{
label: 'Donors:',
type: 'int',
value: ''
},
{
label: 'Age:',
type: 'range',
Expand Down

0 comments on commit 294041e

Please sign in to comment.