Commit cd0d76da authored by Winnie Hellmann's avatar Winnie Hellmann Committed by Kushal Pandya

Support 0 weight in issue sidebar

parent 7f94e28f
...@@ -13,9 +13,9 @@ export default class SidebarStore extends CESidebarStore { ...@@ -13,9 +13,9 @@ export default class SidebarStore extends CESidebarStore {
this.epic = {}; this.epic = {};
} }
setWeightData(data) { setWeightData({ weight }) {
this.isFetching.weight = false; this.isFetching.weight = false;
this.weight = data.weight || null; this.weight = typeof weight === 'number' ? Number(weight) : null;
} }
setWeight(newWeight) { setWeight(newWeight) {
......
---
title: Support 0 weight in issue sidebar
merge_request: 14683
author:
type: fixed
...@@ -17,16 +17,28 @@ describe('EE Sidebar store', () => { ...@@ -17,16 +17,28 @@ describe('EE Sidebar store', () => {
CESidebarStore.singleton = null; CESidebarStore.singleton = null;
}); });
it('sets weight data', () => { describe('setWeightData', () => {
expect(store.weight).toEqual(null); beforeEach(() => {
expect(store.weight).toEqual(null);
});
it('sets weight data', () => {
const weight = 3;
store.setWeightData({
weight,
});
const weight = 3; expect(store.isFetching.weight).toEqual(false);
store.setWeightData({ expect(store.weight).toEqual(weight);
weight,
}); });
expect(store.isFetching.weight).toEqual(false); it('supports 0 weight', () => {
expect(store.weight).toEqual(weight); store.setWeightData({
weight: 0,
});
expect(store.weight).toBe(0);
});
}); });
it('set weight', () => { it('set weight', () => {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment