mirror of
https://github.com/datahub-project/datahub.git
synced 2025-10-12 09:25:23 +00:00

* Releases updated version of datahub-web client UI code * Fix typo in yarn lock * Change yarn lock to match yarn registry directories * Previous commit missed some paths * Even more changes to yarnlock missing in previous commit * Include codegen file for typings * Add files to get parity for datahub-web and current OS datahub-midtier * Add in typo fix from previous commit - change to proper license * Implement proper OS fix for person entity picture url * Workarounds for open source DH issues * Fixes institutional memory api and removes unopensourced tabs for datasets * Fixes search dataset deprecation and user search issue as a result of changes * Remove internal only options in the avatar menu
62 lines
2.0 KiB
TypeScript
62 lines
2.0 KiB
TypeScript
import { module, test } from 'qunit';
|
|
import { setupRenderingTest } from 'ember-qunit';
|
|
import { render, findAll, click } from '@ember/test-helpers';
|
|
import hbs from 'htmlbars-inline-precompile';
|
|
import { baseToggleClass } from '@nacho-ui/button/components/nacho-toggle';
|
|
|
|
module('Integration | Component | nacho-toggle', function(hooks) {
|
|
setupRenderingTest(hooks);
|
|
|
|
const baseClass = `.${baseToggleClass}`;
|
|
const rightButton = `${baseClass}__button--right`;
|
|
const leftButton = `${baseClass}__button--left`;
|
|
const activeButton = `${baseClass}__button--active`;
|
|
|
|
test('it renders and behaves as expected', async function(assert) {
|
|
await render(hbs`{{nacho-toggle}}`);
|
|
assert.expect(7);
|
|
assert.ok(this.element, 'Initial render is without renders');
|
|
|
|
this.setProperties({
|
|
value: 'Pikachu',
|
|
leftValue: 'Pikachu',
|
|
rightValue: 'Eevee'
|
|
});
|
|
|
|
this.set('onChangeValue', (newValue: string): void => {
|
|
assert.equal(newValue, 'Eevee', 'Change value behaves as expected');
|
|
this.set('value', newValue);
|
|
});
|
|
|
|
await render(hbs`{{nacho-toggle
|
|
value=value
|
|
leftOptionValue=leftValue
|
|
leftOptionText=leftValue
|
|
rightOptionValue=rightValue
|
|
rightOptionText=rightValue
|
|
onChange=onChangeValue
|
|
}}`);
|
|
|
|
assert.equal(findAll(baseClass).length, 1, 'Renders the main component');
|
|
assert.equal(findAll('button').length, 2, 'Renders 2 "buttons" for toggling between two states');
|
|
assert.equal(
|
|
findAll(`${leftButton}${activeButton}`).length,
|
|
1,
|
|
'Based on parameters, left button should be currently active'
|
|
);
|
|
assert.equal(
|
|
findAll(`${rightButton}${activeButton}`).length,
|
|
0,
|
|
'Based on parameters, right button should not be active'
|
|
);
|
|
|
|
await click(rightButton);
|
|
|
|
assert.equal(
|
|
findAll(`${rightButton}${activeButton}`).length,
|
|
1,
|
|
'After changing state, right button should be active'
|
|
);
|
|
});
|
|
});
|