Skip to content

Commit

Permalink
Change some class names and fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Hugo authored and Hugo committed Aug 24, 2018
1 parent 52d5cf4 commit 3e16826
Show file tree
Hide file tree
Showing 9 changed files with 44 additions and 37 deletions.
14 changes: 12 additions & 2 deletions src/bh/components/BhCard.vue
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
<template>
<div class="bh-card">
<slot />
<div class="bh-card__main">
<slot />
</div>
<div
v-if="$slots.append"
class="bh-card">
class="bh-card__append">
<slot name="append"/>
</div>
</div>
Expand All @@ -22,6 +24,14 @@ export default {
border: 1px solid rgba(207, 213, 217, 1);
border-radius: 4px;
box-shadow: 1px 1px 3px 1px rgba(0, 0, 0, 0.16);
&__main {
flex-grow: 1;
}
&__append {
flex-grow: 0;
}
}
}
</style>
13 changes: 7 additions & 6 deletions src/components/repository/IntentsAndLabelsCard.vue
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@
<div class="i-a-l-card__left__content">
<strong>{{ title }}</strong>
<div class="i-a-l-card__left__content__info">
<p><strong>{{ 0 }}</strong> Sentences</p>
<p v-if="labelEntities"><strong>{{ 0 }}</strong> Entities</p>
<span><strong>{{ 0 }}</strong> Sentences</span>
<span v-if="labelEntities"><strong>{{ 0 }}</strong> Entities</span>
</div>
</div>
<p v-if="labelEntities">Entities</p>
<span v-if="labelEntities">Entities</span>
</div>
<div
v-if="labelEntities"
Expand All @@ -19,10 +19,10 @@
v-for="(entities, i) in labelEntities"
:key="i"
:class="[
'entities__entity',
getEntityClass(entities),
]"
size="small"
class="entities__entity">
size="small">
<span>{{ entities }}</span>
</bh-badge>
</div>
Expand All @@ -40,6 +40,7 @@ const components = {
BhCard,
BhBadge,
};
export default {
name: 'IntentsAndLabelsCard',
components,
Expand Down Expand Up @@ -88,7 +89,7 @@ export default {
display: flex;
flex-direction: column;
justify-content: space-between;
width: 100%;
flex-grow: 1;
&__info {
display: flex;
Expand Down
6 changes: 3 additions & 3 deletions src/components/repository/IntentsAndLabelsList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@
:primary="listActived === 'intents'"
class="intents-and-labels-list__radio__button"
size="medium"
@click="activeRadioButton('intents')" >
@click="activeList('intents')" >
Intents
</bh-button>
<bh-button
ref="labels"
:primary="listActived === 'labels'"
class="intents-and-labels-list__radio__button"
size="medium"
@click="activeRadioButton('labels')">
@click="activeList('labels')">
Labels
</bh-button>
</div>
Expand Down Expand Up @@ -65,7 +65,7 @@ export default {
};
},
methods: {
activeRadioButton(value) {
activeList(value) {
this.listActived = value;
},
},
Expand Down
2 changes: 1 addition & 1 deletion test/unit/specs/bh/BhCard.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import BhCard from 'bh/components/BhCard';

const localVue = createLocalVue();
localVue.use(BH);
const pComponentContent = compileToFunctions('<div class="bh-card__left__content__flex-display"><span>Teste Slot content </span> </div>');
const pComponentContent = compileToFunctions('<div class="bh-card__left__content__flex-display"><span>Test Slot content </span> </div>');

describe('BhCard.vue', () => {
let wrapper;
Expand Down
8 changes: 5 additions & 3 deletions test/unit/specs/bh/__snapshots__/BhCard.spec.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,11 @@

exports[`BhCard.vue renders correctly 1`] = `
<div class="bh-card">
<div class="bh-card__left__content__flex-display"><span>Teste Slot content </span></div>
<div class="bh-card">
<div class="bh-card__left__content__flex-display"><span>Teste Slot content </span></div>
<div class="bh-card__main">
<div class="bh-card__left__content__flex-display"><span>Test Slot content </span></div>
</div>
<div class="bh-card__append">
<div class="bh-card__left__content__flex-display"><span>Test Slot content </span></div>
</div>
</div>
`;
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import IntentsAndLabelsCard from '@/components/repository/IntentsAndLabelsCard';

const localVue = createLocalVue();

describe('RepositoryCard.vue', () => {
describe('IntentsAndLabelsCard.vue', () => {
let wrapper;
beforeEach(() => {
wrapper = shallowMount(IntentsAndLabelsCard, {
Expand All @@ -19,7 +19,7 @@ describe('RepositoryCard.vue', () => {
expect(wrapper).toMatchSnapshot();
});

describe('RepositoryCard.vue renders correctly with diferents props', () => {
describe('renders correctly with diferents props', () => {
beforeEach(() => {
wrapper.setProps({
labelEntities: ['Dog', 'Cat', 'Buy'],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import IntentsAndLabelsList from '@/components/repository/IntentsAndLabelsList';

const localVue = createLocalVue();

describe('RepositoryCard.vue', () => {
describe('IntentsAndLabelsList.vue', () => {
let wrapper;
beforeEach(() => {
wrapper = shallowMount(IntentsAndLabelsList, {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,39 +1,33 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`RepositoryCard.vue RepositoryCard.vue renders correctly with diferents props When labelEntities array props have a array. Renders correctly 1`] = `
exports[`IntentsAndLabelsCard.vue renders correctly 1`] = `
<bhcard-stub>
<div class="i-a-l-card">
<div class="i-a-l-card__left">
<div class="i-a-l-card__left__content"><strong>dog</strong>
<div class="i-a-l-card__left__content__info">
<p><strong>0</strong> Sentences</p>
<p><strong>0</strong> Entities</p>
<div class="i-a-l-card__left__content__info"><span><strong>0</strong> Sentences</span>
<!---->
</div>
</div>
<p>Entities</p>
</div>
<div slot="append" class="entities">
<bhbadge-stub class="entities__entity entity-sunflower"><span>Dog</span></bhbadge-stub>
<bhbadge-stub class="entities__entity entity-energos"><span>Cat</span></bhbadge-stub>
<bhbadge-stub class="entities__entity entity-blue-martina"><span>Buy</span></bhbadge-stub>
<!---->
</div>
<!---->
</div>
</bhcard-stub>
`;

exports[`RepositoryCard.vue renders correctly 1`] = `
exports[`IntentsAndLabelsCard.vue renders correctly with diferents props When labelEntities array props have a array. Renders correctly 1`] = `
<bhcard-stub>
<div class="i-a-l-card">
<div class="i-a-l-card__left">
<div class="i-a-l-card__left__content"><strong>dog</strong>
<div class="i-a-l-card__left__content__info">
<p><strong>0</strong> Sentences</p>
<!---->
</div>
</div>
<!---->
<div class="i-a-l-card__left__content__info"><span><strong>0</strong> Sentences</span> <span><strong>0</strong> Entities</span></div>
</div> <span>Entities</span></div>
<div slot="append" class="entities">
<bhbadge-stub class="entities__entity entity-sunflower"><span>Dog</span></bhbadge-stub>
<bhbadge-stub class="entities__entity entity-energos"><span>Cat</span></bhbadge-stub>
<bhbadge-stub class="entities__entity entity-blue-martina"><span>Buy</span></bhbadge-stub>
</div>
<!---->
</div>
</bhcard-stub>
`;
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`RepositoryCard.vue renders correctly 1`] = `
exports[`IntentsAndLabelsList.vue renders correctly 1`] = `
<div class="intents-and-labels-list">
<div class="intents-and-labels-list__radio">
<bhbutton-stub class="intents-and-labels-list__radio__button">
Expand Down

0 comments on commit 3e16826

Please sign in to comment.