diff --git a/src/components/ftbot/ProfitSymbol.vue b/src/components/ftbot/ProfitSymbol.vue index 52de4817..89614fde 100644 --- a/src/components/ftbot/ProfitSymbol.vue +++ b/src/components/ftbot/ProfitSymbol.vue @@ -5,34 +5,31 @@ - diff --git a/src/components/ftbot/TradeList.vue b/src/components/ftbot/TradeList.vue index 859c919e..ea24f4c4 100644 --- a/src/components/ftbot/TradeList.vue +++ b/src/components/ftbot/TradeList.vue @@ -82,13 +82,12 @@ import DeleteIcon from 'vue-material-design-icons/Delete.vue'; import ForceSellIcon from 'vue-material-design-icons/CloseBoxMultiple.vue'; import DateTimeTZ from '@/components/general/DateTimeTZ.vue'; import { BotStoreGetters } from '@/store/modules/ftbot'; -import ProfitSymbol from './ProfitSymbol.vue'; import TradeProfit from './TradeProfit.vue'; const ftbot = namespace('ftbot'); @Component({ - components: { ProfitSymbol, DeleteIcon, ForceSellIcon, DateTimeTZ, TradeProfit }, + components: { DeleteIcon, ForceSellIcon, DateTimeTZ, TradeProfit }, }) export default class TradeList extends Vue { $refs!: { diff --git a/src/components/general/ProfitPill.vue b/src/components/general/ProfitPill.vue index 5da35a76..20ea4ed2 100644 --- a/src/components/general/ProfitPill.vue +++ b/src/components/general/ProfitPill.vue @@ -1,17 +1,21 @@ @@ -19,7 +23,9 @@ import { formatPercent, formatPrice, timestampms } from '@/shared/formatters'; import { Component, Prop, Vue } from 'vue-property-decorator'; -@Component({}) +import ProfitSymbol from '@/components/ftbot/ProfitSymbol.vue'; + +@Component({ components: { ProfitSymbol } }) export default class ProfitPill extends Vue { @Prop({ required: false, default: undefined, type: Number }) profitRatio?: number; @@ -57,7 +63,6 @@ export default class ProfitPill extends Vue { border-radius: 6px; } .profit-pill-profit { - background: $color-profit; border: 2px solid $color-profit; } diff --git a/tests/unit/ProfitSymbol.spec.ts b/tests/unit/ProfitSymbol.spec.ts index 02dd5335..b6dad13a 100644 --- a/tests/unit/ProfitSymbol.spec.ts +++ b/tests/unit/ProfitSymbol.spec.ts @@ -7,40 +7,32 @@ describe('ProfitSymbol.vue', () => { let cmp; beforeEach(() => { - cmp = mount(ProfitSymbol, { propsData: { trade: {} } }); + cmp = mount(ProfitSymbol, { propsData: { profit: 0 } }); }); it('calculates isProfitable with negative profit', async () => { - const trade = { - profit_ratio: -0.5, - }; - cmp.setProps({ trade }); + const profit = -0.5; + cmp.setProps({ profit }); await Vue.nextTick(); expect(cmp.vm.isProfitable).toBe(false); }); it('calculates isProfitable with positive profit', async () => { - const trade = { - profit_ratio: 0.5, - }; - cmp.setProps({ trade }); + const profit = 0.5; + cmp.setProps({ profit }); await Vue.nextTick(); expect(cmp.vm.isProfitable).toBe(true); }); it('renders triangle down when profit is negative', async () => { - const trade = { - profit_ratio: -0.5, - }; - cmp.setProps({ trade }); + const profit = -0.5; + cmp.setProps({ profit }); await Vue.nextTick(); expect(cmp.html()).toContain('triangle-down'); expect(cmp.html()).not.toContain('triangle-up'); }); it('renders triangle up when profit is positive', async () => { - const trade = { - profit_ratio: 0.5, - }; - cmp.setProps({ trade }); + const profit = 0.5; + cmp.setProps({ profit }); await Vue.nextTick(); expect(cmp.html()).toContain('triangle-up'); expect(cmp.html()).not.toContain('triangle-down');