Charlie Tran 843a6c5bbb
feat(frontend): update datahub-web client UI code (#1806)
* 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
2020-08-26 15:44:50 -07:00

55 lines
1.7 KiB
TypeScript

import { module, test } from 'qunit';
import { setupRenderingTest } from 'ember-qunit';
import { render } from '@ember/test-helpers';
import hbs from 'htmlbars-inline-precompile';
import { IHydrateEntity, ILinearLayoutComponent } from '@datahub/data-models/types/entity/rendering/page-components';
import Component from '@ember/component';
import { MockEntity } from '@datahub/data-models/entity/mock/mock-entity';
import { stubService } from '@datahub/utils/test-helpers/stub-service';
import sinon from 'sinon';
class Layout1 extends Component {
layout = hbs`Prop1: {{@entity.entity.prop1}}`;
}
class MyMockEntity extends MockEntity<{ prop1: string }> {}
module('Integration | Component | entity-page/entity-page-content/hidrate-entity', function(hooks) {
setupRenderingTest(hooks);
test('it renders', async function(assert) {
const completeEntity = new MyMockEntity('urn');
completeEntity.entity = { prop1: 'hello' };
const dataModels = {
createInstance: sinon.fake.returns(completeEntity)
};
this.owner.register('component:layout', Layout1);
stubService('data-models', dataModels);
const hydrate: IHydrateEntity = {
name: 'entity-page/entity-page-content/hydrate-entity',
options: {
component: {
name: 'layout'
}
}
};
const options: ILinearLayoutComponent<MockEntity>['options'] = {
components: [hydrate]
};
this.setProperties({
entity: new MockEntity('urn'),
options
});
await render(hbs`<EntityPage::Layouts::LinearLayout @entity={{this.entity}} @options={{this.options}} />`);
assert.ok(dataModels.createInstance.calledOnce);
assert.dom().containsText('Prop1: hello');
});
});