Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(client): fix DMN navigation #1321

Merged
merged 1 commit into from
Mar 20, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion client/src/app/tabs/MultiSheetTab.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ export class MultiSheetTab extends CachedComponent {
.filter(sheet => sheet.provider !== provider)
.concat(wiredNewSheets)
.map(t => ({ ...t, order: t.order || 0 }))
.sort((a, b) => a.order > b.order);
.sort((a, b) => a.order - b.order);

if (newActiveSheet) {
activeSheet = sheets.find(s => s.id === newActiveSheet.id);
Expand Down
37 changes: 37 additions & 0 deletions client/src/app/tabs/__tests__/MultiSheetTabSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,37 @@ describe('<MultiSheetTab>', function() {
});


describe('#sheetsChanged', function() {

it('should order sheets', function() {

// given
const {
instance
} = renderTab();

const sheets = [
{ id: '2', order: -1 },
{ id: '3', order: 0 },
{ id: '1', order: -2 },
{ id: '4', order: 1 },
];

// when
instance.sheetsChanged(sheets);

// then
expectSheetOrder(instance.getCached().sheets, [
'1',
'2',
'3',
'4'
]);
});

});


describe('dirty state', function() {

let instance,
Expand Down Expand Up @@ -425,4 +456,10 @@ function renderTab(options = {}) {
instance,
wrapper
};
}

function expectSheetOrder(sheets, expectedOrder) {
sheets.forEach((sheet, index) => {
expect(sheet.id === expectedOrder[ index ]);
});
}
4 changes: 2 additions & 2 deletions client/src/app/tabs/dmn/DmnEditor.js
Original file line number Diff line number Diff line change
Expand Up @@ -200,13 +200,13 @@ export class DmnEditor extends CachedComponent {
let activeSheet;

const sheets = views.map(view => {
const { element } = view;
const { element, type } = view;

const newSheet = {
element,
id: element.id,
name: getSheetName(view),
order: -1
order: type === 'drd' ? -2 : -1
};

if (view === activeView) {
Expand Down