diff --git a/packages/nbdime/src/merge/widget/metadata.ts b/packages/nbdime/src/merge/widget/metadata.ts index 3fe19f85..a06af8de 100644 --- a/packages/nbdime/src/merge/widget/metadata.ts +++ b/packages/nbdime/src/merge/widget/metadata.ts @@ -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 @@ -36,18 +36,23 @@ export class MetadataMergeWidget extends MergePanel { // 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); diff --git a/packages/nbdime/src/styles/merge.css b/packages/nbdime/src/styles/merge.css index 7c48ff41..f97e879c 100644 --- a/packages/nbdime/src/styles/merge.css +++ b/packages/nbdime/src/styles/merge.css @@ -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; } diff --git a/ui-tests/tests/nbdime-merge-test1.spec.ts b/ui-tests/tests/nbdime-merge-test1.spec.ts index 2f4544ee..46eab911 100644 --- a/ui-tests/tests/nbdime-merge-test1.spec.ts +++ b/ui-tests/tests/nbdime-merge-test1.spec.ts @@ -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 }) => { diff --git a/ui-tests/tests/nbdime-merge-test1.spec.ts-snapshots/3-panels-view-1-linux.png b/ui-tests/tests/nbdime-merge-test1.spec.ts-snapshots/3-panels-view-1-linux.png index e852c02f..e91c4e8c 100644 Binary files a/ui-tests/tests/nbdime-merge-test1.spec.ts-snapshots/3-panels-view-1-linux.png and b/ui-tests/tests/nbdime-merge-test1.spec.ts-snapshots/3-panels-view-1-linux.png differ diff --git a/ui-tests/tests/nbdime-merge-test1.spec.ts-snapshots/3-panels-view-1-win32.png b/ui-tests/tests/nbdime-merge-test1.spec.ts-snapshots/3-panels-view-1-win32.png index 6d9d658d..a9f21d5c 100644 Binary files a/ui-tests/tests/nbdime-merge-test1.spec.ts-snapshots/3-panels-view-1-win32.png and b/ui-tests/tests/nbdime-merge-test1.spec.ts-snapshots/3-panels-view-1-win32.png differ diff --git a/ui-tests/tests/nbdime-merge-test1.spec.ts-snapshots/merge-test1-choose-central-version-for-conflict-1-linux.png b/ui-tests/tests/nbdime-merge-test1.spec.ts-snapshots/merge-test1-choose-central-version-for-conflict-1-linux.png index 6750a8d9..24291cb8 100644 Binary files a/ui-tests/tests/nbdime-merge-test1.spec.ts-snapshots/merge-test1-choose-central-version-for-conflict-1-linux.png and b/ui-tests/tests/nbdime-merge-test1.spec.ts-snapshots/merge-test1-choose-central-version-for-conflict-1-linux.png differ diff --git a/ui-tests/tests/nbdime-merge-test1.spec.ts-snapshots/merge-test1-choose-central-version-for-conflict-1-win32.png b/ui-tests/tests/nbdime-merge-test1.spec.ts-snapshots/merge-test1-choose-central-version-for-conflict-1-win32.png index aa523049..5d045597 100644 Binary files a/ui-tests/tests/nbdime-merge-test1.spec.ts-snapshots/merge-test1-choose-central-version-for-conflict-1-win32.png and b/ui-tests/tests/nbdime-merge-test1.spec.ts-snapshots/merge-test1-choose-central-version-for-conflict-1-win32.png differ diff --git a/ui-tests/tests/nbdime-merge-test1.spec.ts-snapshots/merge-test1-choose-left-version-for-conflict-1-linux.png b/ui-tests/tests/nbdime-merge-test1.spec.ts-snapshots/merge-test1-choose-left-version-for-conflict-1-linux.png index 2f65d617..b1ab0aea 100644 Binary files a/ui-tests/tests/nbdime-merge-test1.spec.ts-snapshots/merge-test1-choose-left-version-for-conflict-1-linux.png and b/ui-tests/tests/nbdime-merge-test1.spec.ts-snapshots/merge-test1-choose-left-version-for-conflict-1-linux.png differ diff --git a/ui-tests/tests/nbdime-merge-test1.spec.ts-snapshots/merge-test1-choose-left-version-for-conflict-1-win32.png b/ui-tests/tests/nbdime-merge-test1.spec.ts-snapshots/merge-test1-choose-left-version-for-conflict-1-win32.png index 5d2b050e..8476c7e1 100644 Binary files a/ui-tests/tests/nbdime-merge-test1.spec.ts-snapshots/merge-test1-choose-left-version-for-conflict-1-win32.png and b/ui-tests/tests/nbdime-merge-test1.spec.ts-snapshots/merge-test1-choose-left-version-for-conflict-1-win32.png differ diff --git a/ui-tests/tests/nbdime-merge-test1.spec.ts-snapshots/merge-test1-choose-right-version-for-conflict-1-linux.png b/ui-tests/tests/nbdime-merge-test1.spec.ts-snapshots/merge-test1-choose-right-version-for-conflict-1-linux.png index cb484099..5a9bcea9 100644 Binary files a/ui-tests/tests/nbdime-merge-test1.spec.ts-snapshots/merge-test1-choose-right-version-for-conflict-1-linux.png and b/ui-tests/tests/nbdime-merge-test1.spec.ts-snapshots/merge-test1-choose-right-version-for-conflict-1-linux.png differ diff --git a/ui-tests/tests/nbdime-merge-test1.spec.ts-snapshots/merge-test1-choose-right-version-for-conflict-1-win32.png b/ui-tests/tests/nbdime-merge-test1.spec.ts-snapshots/merge-test1-choose-right-version-for-conflict-1-win32.png index 993c518b..157d2e63 100644 Binary files a/ui-tests/tests/nbdime-merge-test1.spec.ts-snapshots/merge-test1-choose-right-version-for-conflict-1-win32.png and b/ui-tests/tests/nbdime-merge-test1.spec.ts-snapshots/merge-test1-choose-right-version-for-conflict-1-win32.png differ diff --git a/ui-tests/tests/nbdime-merge-test1.spec.ts-snapshots/merge-test1-should-not-collapse-source-for-unchanged-metadata-1-linux.png b/ui-tests/tests/nbdime-merge-test1.spec.ts-snapshots/merge-test1-should-not-collapse-source-for-unchanged-metadata-1-linux.png new file mode 100644 index 00000000..40b4f5dc Binary files /dev/null and b/ui-tests/tests/nbdime-merge-test1.spec.ts-snapshots/merge-test1-should-not-collapse-source-for-unchanged-metadata-1-linux.png differ diff --git a/ui-tests/tests/nbdime-merge-test1.spec.ts-snapshots/merge-test1-should-not-collapse-source-for-unchanged-metadata-1-win32.png b/ui-tests/tests/nbdime-merge-test1.spec.ts-snapshots/merge-test1-should-not-collapse-source-for-unchanged-metadata-1-win32.png new file mode 100644 index 00000000..e1016104 Binary files /dev/null and b/ui-tests/tests/nbdime-merge-test1.spec.ts-snapshots/merge-test1-should-not-collapse-source-for-unchanged-metadata-1-win32.png differ diff --git a/ui-tests/tests/nbdime-merge-test1.spec.ts-snapshots/merge-test1-take-a-snapshot-at-opening-1-linux.png b/ui-tests/tests/nbdime-merge-test1.spec.ts-snapshots/merge-test1-take-a-snapshot-at-opening-1-linux.png index 57beb790..6bdbd847 100644 Binary files a/ui-tests/tests/nbdime-merge-test1.spec.ts-snapshots/merge-test1-take-a-snapshot-at-opening-1-linux.png and b/ui-tests/tests/nbdime-merge-test1.spec.ts-snapshots/merge-test1-take-a-snapshot-at-opening-1-linux.png differ diff --git a/ui-tests/tests/nbdime-merge-test1.spec.ts-snapshots/merge-test1-take-a-snapshot-at-opening-1-win32.png b/ui-tests/tests/nbdime-merge-test1.spec.ts-snapshots/merge-test1-take-a-snapshot-at-opening-1-win32.png index fa631915..9d13891a 100644 Binary files a/ui-tests/tests/nbdime-merge-test1.spec.ts-snapshots/merge-test1-take-a-snapshot-at-opening-1-win32.png and b/ui-tests/tests/nbdime-merge-test1.spec.ts-snapshots/merge-test1-take-a-snapshot-at-opening-1-win32.png differ diff --git a/ui-tests/tests/nbdime-merge-test2.spec.ts-snapshots/merge-test2-choose-central-version-1-linux.png b/ui-tests/tests/nbdime-merge-test2.spec.ts-snapshots/merge-test2-choose-central-version-1-linux.png index b1e39b21..1f3a4e20 100644 Binary files a/ui-tests/tests/nbdime-merge-test2.spec.ts-snapshots/merge-test2-choose-central-version-1-linux.png and b/ui-tests/tests/nbdime-merge-test2.spec.ts-snapshots/merge-test2-choose-central-version-1-linux.png differ diff --git a/ui-tests/tests/nbdime-merge-test2.spec.ts-snapshots/merge-test2-choose-central-version-1-win32.png b/ui-tests/tests/nbdime-merge-test2.spec.ts-snapshots/merge-test2-choose-central-version-1-win32.png index dcf517d8..43ab514a 100644 Binary files a/ui-tests/tests/nbdime-merge-test2.spec.ts-snapshots/merge-test2-choose-central-version-1-win32.png and b/ui-tests/tests/nbdime-merge-test2.spec.ts-snapshots/merge-test2-choose-central-version-1-win32.png differ diff --git a/ui-tests/tests/nbdime-merge-test2.spec.ts-snapshots/merge-test2-choose-left-version-1-linux.png b/ui-tests/tests/nbdime-merge-test2.spec.ts-snapshots/merge-test2-choose-left-version-1-linux.png index 6963048c..256b40f7 100644 Binary files a/ui-tests/tests/nbdime-merge-test2.spec.ts-snapshots/merge-test2-choose-left-version-1-linux.png and b/ui-tests/tests/nbdime-merge-test2.spec.ts-snapshots/merge-test2-choose-left-version-1-linux.png differ diff --git a/ui-tests/tests/nbdime-merge-test2.spec.ts-snapshots/merge-test2-choose-left-version-1-win32.png b/ui-tests/tests/nbdime-merge-test2.spec.ts-snapshots/merge-test2-choose-left-version-1-win32.png index 85a88f77..62d27e3e 100644 Binary files a/ui-tests/tests/nbdime-merge-test2.spec.ts-snapshots/merge-test2-choose-left-version-1-win32.png and b/ui-tests/tests/nbdime-merge-test2.spec.ts-snapshots/merge-test2-choose-left-version-1-win32.png differ diff --git a/ui-tests/tests/nbdime-merge-test2.spec.ts-snapshots/merge-test2-choose-right-version-1-linux.png b/ui-tests/tests/nbdime-merge-test2.spec.ts-snapshots/merge-test2-choose-right-version-1-linux.png index 6963048c..256b40f7 100644 Binary files a/ui-tests/tests/nbdime-merge-test2.spec.ts-snapshots/merge-test2-choose-right-version-1-linux.png and b/ui-tests/tests/nbdime-merge-test2.spec.ts-snapshots/merge-test2-choose-right-version-1-linux.png differ diff --git a/ui-tests/tests/nbdime-merge-test2.spec.ts-snapshots/merge-test2-choose-right-version-1-win32.png b/ui-tests/tests/nbdime-merge-test2.spec.ts-snapshots/merge-test2-choose-right-version-1-win32.png index 85a88f77..62d27e3e 100644 Binary files a/ui-tests/tests/nbdime-merge-test2.spec.ts-snapshots/merge-test2-choose-right-version-1-win32.png and b/ui-tests/tests/nbdime-merge-test2.spec.ts-snapshots/merge-test2-choose-right-version-1-win32.png differ diff --git a/ui-tests/tests/nbdime-merge-test2.spec.ts-snapshots/merge-test2-take-a-snapshot-at-opening-1-linux.png b/ui-tests/tests/nbdime-merge-test2.spec.ts-snapshots/merge-test2-take-a-snapshot-at-opening-1-linux.png index 6963048c..256b40f7 100644 Binary files a/ui-tests/tests/nbdime-merge-test2.spec.ts-snapshots/merge-test2-take-a-snapshot-at-opening-1-linux.png and b/ui-tests/tests/nbdime-merge-test2.spec.ts-snapshots/merge-test2-take-a-snapshot-at-opening-1-linux.png differ diff --git a/ui-tests/tests/nbdime-merge-test2.spec.ts-snapshots/merge-test2-take-a-snapshot-at-opening-1-win32.png b/ui-tests/tests/nbdime-merge-test2.spec.ts-snapshots/merge-test2-take-a-snapshot-at-opening-1-win32.png index 85a88f77..62d27e3e 100644 Binary files a/ui-tests/tests/nbdime-merge-test2.spec.ts-snapshots/merge-test2-take-a-snapshot-at-opening-1-win32.png and b/ui-tests/tests/nbdime-merge-test2.spec.ts-snapshots/merge-test2-take-a-snapshot-at-opening-1-win32.png differ diff --git a/ui-tests/tests/nbdime-merge-test4.spec.ts-snapshots/merge-test4-should-synchronize-the-collapse-status-between-editor-1-linux.png b/ui-tests/tests/nbdime-merge-test4.spec.ts-snapshots/merge-test4-should-synchronize-the-collapse-status-between-editor-1-linux.png index ed8eb9ee..a42c137e 100644 Binary files a/ui-tests/tests/nbdime-merge-test4.spec.ts-snapshots/merge-test4-should-synchronize-the-collapse-status-between-editor-1-linux.png and b/ui-tests/tests/nbdime-merge-test4.spec.ts-snapshots/merge-test4-should-synchronize-the-collapse-status-between-editor-1-linux.png differ diff --git a/ui-tests/tests/nbdime-merge-test4.spec.ts-snapshots/merge-test4-should-synchronize-the-collapse-status-between-editor-1-win32.png b/ui-tests/tests/nbdime-merge-test4.spec.ts-snapshots/merge-test4-should-synchronize-the-collapse-status-between-editor-1-win32.png index 85d9ac6f..231dc57f 100644 Binary files a/ui-tests/tests/nbdime-merge-test4.spec.ts-snapshots/merge-test4-should-synchronize-the-collapse-status-between-editor-1-win32.png and b/ui-tests/tests/nbdime-merge-test4.spec.ts-snapshots/merge-test4-should-synchronize-the-collapse-status-between-editor-1-win32.png differ diff --git a/ui-tests/tests/nbdime-merge-test5.spec.ts-snapshots/merge-test5-take-a-snapshot-at-opening-1-linux.png b/ui-tests/tests/nbdime-merge-test5.spec.ts-snapshots/merge-test5-take-a-snapshot-at-opening-1-linux.png index 72ba7ae5..69347345 100644 Binary files a/ui-tests/tests/nbdime-merge-test5.spec.ts-snapshots/merge-test5-take-a-snapshot-at-opening-1-linux.png and b/ui-tests/tests/nbdime-merge-test5.spec.ts-snapshots/merge-test5-take-a-snapshot-at-opening-1-linux.png differ diff --git a/ui-tests/tests/nbdime-merge-test5.spec.ts-snapshots/merge-test5-take-a-snapshot-at-opening-1-win32.png b/ui-tests/tests/nbdime-merge-test5.spec.ts-snapshots/merge-test5-take-a-snapshot-at-opening-1-win32.png index d8011f98..bf5c750d 100644 Binary files a/ui-tests/tests/nbdime-merge-test5.spec.ts-snapshots/merge-test5-take-a-snapshot-at-opening-1-win32.png and b/ui-tests/tests/nbdime-merge-test5.spec.ts-snapshots/merge-test5-take-a-snapshot-at-opening-1-win32.png differ diff --git a/ui-tests/tests/nbdime-merge-test6.spec.ts-snapshots/merge-test6-take-a-snapshot-at-opening-1-linux.png b/ui-tests/tests/nbdime-merge-test6.spec.ts-snapshots/merge-test6-take-a-snapshot-at-opening-1-linux.png index 35f61178..28f1a255 100644 Binary files a/ui-tests/tests/nbdime-merge-test6.spec.ts-snapshots/merge-test6-take-a-snapshot-at-opening-1-linux.png and b/ui-tests/tests/nbdime-merge-test6.spec.ts-snapshots/merge-test6-take-a-snapshot-at-opening-1-linux.png differ diff --git a/ui-tests/tests/nbdime-merge-test6.spec.ts-snapshots/merge-test6-take-a-snapshot-at-opening-1-win32.png b/ui-tests/tests/nbdime-merge-test6.spec.ts-snapshots/merge-test6-take-a-snapshot-at-opening-1-win32.png index 8f3f5071..62543bd9 100644 Binary files a/ui-tests/tests/nbdime-merge-test6.spec.ts-snapshots/merge-test6-take-a-snapshot-at-opening-1-win32.png and b/ui-tests/tests/nbdime-merge-test6.spec.ts-snapshots/merge-test6-take-a-snapshot-at-opening-1-win32.png differ