From c1f7538fabd6043c917c5bf8f5cad6e2b0e6972c Mon Sep 17 00:00:00 2001 From: VonnyJap Date: Wed, 20 Nov 2024 17:27:22 -0800 Subject: [PATCH] reset number of builds when leaving jobs list view --- .../pipeline-list-view/component.js | 5 +- .../pipeline-list-view/component-test.js | 64 +++++++++++++++++++ 2 files changed, 68 insertions(+), 1 deletion(-) diff --git a/app/components/pipeline-list-view/component.js b/app/components/pipeline-list-view/component.js index 7bcce4e41..afbd8e7e2 100644 --- a/app/components/pipeline-list-view/component.js +++ b/app/components/pipeline-list-view/component.js @@ -333,7 +333,10 @@ export default Component.extend({ } } ), - + willDestroy() { + this._super(...arguments); + this.updateNumBuilds(this.defaultNumBuilds); + }, actions: { async onScrolledToBottom({ currentTarget }) { const { scrollTop, scrollHeight, clientHeight } = currentTarget; diff --git a/tests/integration/components/pipeline-list-view/component-test.js b/tests/integration/components/pipeline-list-view/component-test.js index d8a125af0..4aadb0d6a 100644 --- a/tests/integration/components/pipeline-list-view/component-test.js +++ b/tests/integration/components/pipeline-list-view/component-test.js @@ -79,6 +79,10 @@ module('Integration | Component | pipeline list view', function (hooks) { set(this, 'setShowListView', () => { assert.ok(true); }); + set(this, 'defaultNumBuilds', ENV.APP.NUM_BUILDS_LISTED); + set(this, 'updateNumBuilds', () => { + assert.ok(true); + }); await render(hbs``); assert.dom('table').exists({ count: 1 }); @@ -172,6 +178,10 @@ module('Integration | Component | pipeline list view', function (hooks) { set(this, 'setShowListView', () => { assert.ok(true); }); + set(this, 'defaultNumBuilds', ENV.APP.NUM_BUILDS_LISTED); + set(this, 'updateNumBuilds', () => { + assert.ok(true); + }); await render(hbs` {{#if this.showPipelineListView}} @@ -185,6 +195,8 @@ module('Integration | Component | pipeline list view', function (hooks) { @buildParameters={{this.buildParameters}} @showListView={{this.showListView}} @setShowListView={{this.setShowListView}} + @updateNumBuilds={{this.updateNumBuilds}} + @defaultNumBuilds={{this.defaultNumBuilds}} /> {{/if}}`); @@ -234,6 +246,10 @@ module('Integration | Component | pipeline list view', function (hooks) { set(this, 'setShowListView', () => { assert.ok(true); }); + set(this, 'defaultNumBuilds', ENV.APP.NUM_BUILDS_LISTED); + set(this, 'updateNumBuilds', () => { + assert.ok(true); + }); await render(hbs``); assert.dom('table').exists({ count: 1 }); @@ -300,6 +318,14 @@ module('Integration | Component | pipeline list view', function (hooks) { set(this, 'setShowListView', () => { assert.ok(true); }); + set(this, 'defaultNumBuilds', ENV.APP.NUM_BUILDS_LISTED); + set(this, 'updateNumBuilds', () => { + assert.ok(true); + }); + set(this, 'defaultNumBuilds', ENV.APP.NUM_BUILDS_LISTED); + set(this, 'updateNumBuilds', () => { + assert.ok(true); + }); await render(hbs``); assert.dom('table').exists({ count: 1 }); @@ -365,6 +393,10 @@ module('Integration | Component | pipeline list view', function (hooks) { set(this, 'setShowListView', () => { assert.ok(true); }); + set(this, 'defaultNumBuilds', ENV.APP.NUM_BUILDS_LISTED); + set(this, 'updateNumBuilds', () => { + assert.ok(true); + }); await render(hbs``); assert.dom('table').exists({ count: 1 }); @@ -430,6 +464,10 @@ module('Integration | Component | pipeline list view', function (hooks) { set(this, 'setShowListView', () => { assert.ok(true); }); + set(this, 'defaultNumBuilds', ENV.APP.NUM_BUILDS_LISTED); + set(this, 'updateNumBuilds', () => { + assert.ok(true); + }); await render(hbs``); assert.dom('table').exists({ count: 1 }); @@ -495,6 +535,10 @@ module('Integration | Component | pipeline list view', function (hooks) { set(this, 'setShowListView', () => { assert.ok(true); }); + set(this, 'defaultNumBuilds', ENV.APP.NUM_BUILDS_LISTED); + set(this, 'updateNumBuilds', () => { + assert.ok(true); + }); await render(hbs``); assert.dom('table').exists({ count: 1 }); @@ -560,6 +606,10 @@ module('Integration | Component | pipeline list view', function (hooks) { set(this, 'setShowListView', () => { assert.ok(true); }); + set(this, 'defaultNumBuilds', ENV.APP.NUM_BUILDS_LISTED); + set(this, 'updateNumBuilds', () => { + assert.ok(true); + }); await render(hbs``); assert.dom('table').exists({ count: 1 }); @@ -625,6 +677,10 @@ module('Integration | Component | pipeline list view', function (hooks) { set(this, 'setShowListView', () => { assert.ok(true); }); + set(this, 'defaultNumBuilds', ENV.APP.NUM_BUILDS_LISTED); + set(this, 'updateNumBuilds', () => { + assert.ok(true); + }); await render(hbs``); assert.dom('table').exists({ count: 1 }); @@ -686,6 +744,10 @@ module('Integration | Component | pipeline list view', function (hooks) { set(this, 'setShowListView', () => { assert.ok(true); }); + set(this, 'defaultNumBuilds', ENV.APP.NUM_BUILDS_LISTED); + set(this, 'updateNumBuilds', () => { + assert.ok(true); + }); await render(hbs``); assert.dom('table').exists({ count: 1 });