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

Change header for unchanged notebook meta #736

Merged
merged 7 commits into from
Nov 17, 2023
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
11 changes: 8 additions & 3 deletions packages/nbdime/src/merge/widget/metadata.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import { MergePanel } from '../../common/basepanel';

import type { MetadataMergeModel } from '../model';

const ROOT_METADATA_CLASS = 'jp-Metadata-diff';
const ROOT_METADATA_CLASS = 'jp-Metadata-merge';

/**
* MetadataWidget for changes to Notebook-level metadata
Expand All @@ -36,18 +36,23 @@ export class MetadataMergeWidget extends MergePanel<MetadataMergeModel> {

// We know/assume that MetadataMergeModel never has
// null values for local/remote:
const viewOptions = {...this._viewOptions};
const unchanged = model.decisions.length === 0;
if (unchanged) {
viewOptions.collapseIdentical = false;
}
this.view = createNbdimeMergeView({
remote: model.remote,
local: model.local,
merged: model.merged,
factory: this._editorFactory,
translator: this._translator,
...this._viewOptions,
...viewOptions,
});
const trans = this._translator.load('nbdime');
const wrapper = new CollapsiblePanel(
this.view,
trans.__('Notebook metadata changed'),
unchanged ? trans.__('Notebook metadata unchanged') : trans.__('Notebook metadata changed'),
true,
);
this.addWidget(wrapper);
Expand Down
4 changes: 2 additions & 2 deletions packages/nbdime/src/styles/merge.css
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
.jp-Notebook-merge .jp-Metadata-diff {
.jp-Notebook-merge .jp-Metadata-merge {
margin-bottom: 20px;
}

.jp-Notebook-merge .jp-Metadata-diff .jp-CollapsiblePanel {
.jp-Notebook-merge .jp-Metadata-merge .jp-CollapsiblePanel {
border: solid black thin;
}

Expand Down
5 changes: 5 additions & 0 deletions ui-tests/tests/nbdime-merge-test1.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,11 @@ test.describe('merge test1', () => {
// Finalize download
expect(await download1.failure()).toBeNull();
});

test('should not collapse source for unchanged metadata', async ({ page }) => {
await page.locator('.jp-Metadata-merge .jp-CollapsiblePanel-header-icon').click();
expect(await page.locator('#main').screenshot({animations: 'disabled'})).toMatchSnapshot();
});
});

test('3 panels view', async ({ page }) => {
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading