Skip to content

Commit

Permalink
rename differences component (CR)
Browse files Browse the repository at this point in the history
- SUITEDEV-27058
  • Loading branch information
cztamas committed Mar 22, 2021
1 parent f6b5e90 commit 415fc18
Show file tree
Hide file tree
Showing 9 changed files with 17 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@
</button>
</div>

<differences
<difference-list
:original-secret="secretBefore"
:current-secret="secretAfter"
>
</differences>
</difference-list>
</e-dialog>
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { format } from 'date-fns';
import Differences from '../differences/differences';
import DifferenceList from '../difference-list/difference-list';

export default {
name: 'change-history-dialog',
template: require('./change-history-dialog.html'),
components: { Differences },
components: { DifferenceList },
props: {
backups: Array,
originalSecret: Object,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ import { difference, intersection, keys } from 'lodash';
import Difference from './difference/difference';

export default {
name: 'differences',
template: require('./differences.html'),
name: 'difference-list',
template: require('./difference-list.html'),
components: { Difference },
props: {
originalSecret: Object,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,44 +1,44 @@
import { mount } from '@vue/test-utils';
import Differences from './differences';
import DifferenceList from './difference-list';

describe('Differences', () => {
describe('DifferenceList', () => {
describe('#keysOfChangedFields', () => {
it('should return empty array when nothing changed', () => {
const originalSecret = { DARTH: 'Vader' };
const currentSecret = { DARTH: 'Vader' };
const { vm } = mount(Differences, { propsData: { originalSecret, currentSecret } });
const { vm } = mount(DifferenceList, { propsData: { originalSecret, currentSecret } });

expect(vm.keysOfChangedFields).to.eql([]);
});

it('should return keys of added fields', () => {
const originalSecret = { HAN: 'Solo' };
const currentSecret = { DARTH: 'Vader', HAN: 'Solo', LUKE: 'Skywalker' };
const { vm } = mount(Differences, { propsData: { originalSecret, currentSecret } });
const { vm } = mount(DifferenceList, { propsData: { originalSecret, currentSecret } });

expect(vm.keysOfChangedFields).to.eql(['DARTH', 'LUKE']);
});

it('should return keys of removed fields', () => {
const originalSecret = { DARTH: 'Vader', HAN: 'Solo', LUKE: 'Skywalker' };
const currentSecret = { HAN: 'Solo' };
const { vm } = mount(Differences, { propsData: { originalSecret, currentSecret } });
const { vm } = mount(DifferenceList, { propsData: { originalSecret, currentSecret } });

expect(vm.keysOfChangedFields).to.eql(['DARTH', 'LUKE']);
});

it('should return keys of changed fields', () => {
const originalSecret = { DARTH: 'Vader', HAN: 'Solo', LUKE: 'Skywalker' };
const currentSecret = { DARTH: 'Maul', HAN: 'Solo', LUKE: 'Skywalker' };
const { vm } = mount(Differences, { propsData: { originalSecret, currentSecret } });
const { vm } = mount(DifferenceList, { propsData: { originalSecret, currentSecret } });

expect(vm.keysOfChangedFields).to.eql(['DARTH']);
});

it('should return keys in alphabetical order', () => {
const originalSecret = { DARTH: 'Vader', HAN: 'Solo', LUKE: 'Skywalker' };
const currentSecret = { DARTH: 'Maul', HAN: 'Solo', chew: 'bacca' };
const { vm } = mount(Differences, { propsData: { originalSecret, currentSecret } });
const { vm } = mount(DifferenceList, { propsData: { originalSecret, currentSecret } });

expect(vm.keysOfChangedFields).to.eql(['chew', 'DARTH', 'LUKE']);
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@
headline="Do you want to save the following changes?"
width="90%"
>
<differences
<difference-list
:original-secret="originalSecret"
:current-secret="currentSecret"
>
</differences>
</difference-list>

<div class="e-dialog__footer">
<div class="e-grid e-grid-small">
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import Differences from '../differences/differences';
import DifferenceList from '../difference-list/difference-list';

export default {
name: 'save-confirmation-dialog',
template: require('./save-confirmation-dialog.html'),
components: { Differences },
components: { DifferenceList },
props: {
originalSecret: Object,
currentSecret: Object
Expand Down

0 comments on commit 415fc18

Please sign in to comment.