mirror of
https://github.com/hashicorp/vault.git
synced 2026-02-03 20:40:45 -05:00
* Initial unsaved changes bug fixes * Fix some transition bugs * VAULT-39913 mount params * Fix failing tests * spitballin (#10179) * spitballin * fix second save bug * Fix failing tests * set initital state * Put initial state back --------- * Address feedback! * Fix failing tests * Add changelog --------- Co-authored-by: Kianna <30884335+kiannaquach@users.noreply.github.com> Co-authored-by: claire bontempo <68122737+hellobontempo@users.noreply.github.com>
36 lines
1.4 KiB
JavaScript
36 lines
1.4 KiB
JavaScript
/**
|
|
* Copyright IBM Corp. 2016, 2025
|
|
* SPDX-License-Identifier: BUSL-1.1
|
|
*/
|
|
|
|
import { module, test } from 'qunit';
|
|
import { setupTest } from 'ember-qunit';
|
|
|
|
module('Unit | Service | unsaved-changes', function (hooks) {
|
|
setupTest(hooks);
|
|
|
|
hooks.beforeEach(function () {
|
|
this.unsavedChanges = this.owner.lookup('service:unsaved-changes');
|
|
});
|
|
|
|
test('it should get changedFields', async function (assert) {
|
|
const initialState = { title: 'Title 1', description: 'Old description' };
|
|
const currentState = { title: 'Title 1', description: 'New description' };
|
|
this.unsavedChanges.initialState = initialState;
|
|
this.unsavedChanges.currentState = currentState;
|
|
|
|
assert.deepEqual(this.unsavedChanges.changedFields, ['description']);
|
|
});
|
|
test('it should get hasChanges', async function (assert) {
|
|
const initialState = { title: 'Title 1', description: 'Old description' };
|
|
const currentState = { title: 'Title 1', description: 'New description' };
|
|
this.unsavedChanges.initialState = initialState;
|
|
this.unsavedChanges.currentState = currentState;
|
|
|
|
assert.true(this.unsavedChanges.hasChanges, 'shows that there are unsaved changes');
|
|
currentState.description = 'Old description';
|
|
this.unsavedChanges.initialState = initialState;
|
|
this.unsavedChanges.currentState = currentState;
|
|
assert.false(this.unsavedChanges.hasChanges, 'shows that there are no unsaved changes');
|
|
});
|
|
});
|