2021-12-01 18:41:49 +00:00
|
|
|
import EmberObject from '@ember/object';
|
|
|
|
import { module, test } from 'qunit';
|
|
|
|
import { setupRenderingTest } from 'ember-qunit';
|
2021-12-17 03:44:29 +00:00
|
|
|
import { render, click } from '@ember/test-helpers';
|
2021-12-01 18:41:49 +00:00
|
|
|
import { hbs } from 'ember-cli-htmlbars';
|
|
|
|
|
|
|
|
const VERSIONS = [
|
|
|
|
{
|
|
|
|
version: 2,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
version: 1,
|
|
|
|
},
|
|
|
|
];
|
|
|
|
|
2021-12-17 03:44:29 +00:00
|
|
|
module('Integration | Component | diff-version-selector', function (hooks) {
|
2021-12-01 18:41:49 +00:00
|
|
|
setupRenderingTest(hooks);
|
|
|
|
|
2021-12-17 03:44:29 +00:00
|
|
|
test('it renders', async function (assert) {
|
2021-12-01 18:41:49 +00:00
|
|
|
this.set(
|
|
|
|
'model',
|
|
|
|
EmberObject.create({
|
|
|
|
currentVersion: 2,
|
|
|
|
versions: VERSIONS,
|
|
|
|
})
|
|
|
|
);
|
|
|
|
await render(hbs`<DiffVersionSelector @model={{this.model}} />`);
|
2022-11-09 23:15:31 +00:00
|
|
|
const leftSideVersion = document
|
2021-12-01 18:41:49 +00:00
|
|
|
.querySelector('[data-test-popup-menu-trigger="left-version"]')
|
|
|
|
.innerText.trim();
|
2022-10-18 15:46:02 +00:00
|
|
|
assert.strictEqual(leftSideVersion, 'Version 2', 'left side toolbar defaults to currentVersion');
|
2021-12-01 18:41:49 +00:00
|
|
|
|
|
|
|
await click('[data-test-popup-menu-trigger="left-version"]');
|
2021-12-17 03:44:29 +00:00
|
|
|
|
2021-12-01 18:41:49 +00:00
|
|
|
assert.dom('[data-test-leftSide-version="1"]').exists('leftside shows both versions');
|
|
|
|
assert.dom('[data-test-leftSide-version="2"]').exists('leftside shows both versions');
|
|
|
|
});
|
|
|
|
});
|