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,9 +17,12 @@ describe('EE Sidebar store', () => { ...@@ -17,9 +17,12 @@ describe('EE Sidebar store', () => {
CESidebarStore.singleton = null; CESidebarStore.singleton = null;
}); });
it('sets weight data', () => { describe('setWeightData', () => {
beforeEach(() => {
expect(store.weight).toEqual(null); expect(store.weight).toEqual(null);
});
it('sets weight data', () => {
const weight = 3; const weight = 3;
store.setWeightData({ store.setWeightData({
weight, weight,
...@@ -29,6 +32,15 @@ describe('EE Sidebar store', () => { ...@@ -29,6 +32,15 @@ describe('EE Sidebar store', () => {
expect(store.weight).toEqual(weight); expect(store.weight).toEqual(weight);
}); });
it('supports 0 weight', () => {
store.setWeightData({
weight: 0,
});
expect(store.weight).toBe(0);
});
});
it('set weight', () => { it('set weight', () => {
expect(store.weight).toEqual(null); expect(store.weight).toEqual(null);
const weight = 1; const weight = 1;
......
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