Skip to content

Commit

Permalink
[Tests-refactor] Remove angular code from plugin_functional and updat…
Browse files Browse the repository at this point in the history
…e tests (#5221) (#5224)

* remove angular-based view from DocViewsPlugin
* remove the test case that validates the display and content of the angular doc view

Issue Resolve
#5020

Signed-off-by: ananzh <[email protected]>
(cherry picked from commit 70b9eea)
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
  • Loading branch information
1 parent 6d9f4ae commit 03bc3cc
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 29 deletions.
20 changes: 0 additions & 20 deletions test/plugin_functional/plugins/doc_views_plugin/public/plugin.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,36 +28,16 @@
* under the License.
*/

import angular from 'angular';
import React from 'react';
import { Plugin, CoreSetup } from 'opensearch-dashboards/public';
import { DiscoverSetup } from '../../../../../src/plugins/discover/public';

angular.module('myDocView', []).directive('myHit', () => ({
restrict: 'E',
scope: {
hit: '=hit',
},
template: '<h1 data-test-subj="angular-docview">{{hit._index}}</h1>',
}));

function MyHit(props: { index: string }) {
return <h1 data-test-subj="react-docview">{props.index}</h1>;
}

export class DocViewsPlugin implements Plugin<void, void> {
public setup(core: CoreSetup, { discover }: { discover: DiscoverSetup }) {
discover.docViews.addDocView({
directive: {
controller: function MyController($injector: any) {
$injector.loadNewModules(['myDocView']);
},
template: `<my-hit hit="hit"></my-hit>`,
},
order: 1,
title: 'Angular doc view',
});

discover.docViews.addDocView({
component: (props) => {
return <MyHit index={props.hit._index as string} />;
Expand Down
9 changes: 0 additions & 9 deletions test/plugin_functional/test_suites/doc_views/doc_views.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,19 +44,10 @@ export default function ({ getService, getPageObjects }: PluginFunctionalProvide

it('should show custom doc views', async () => {
await testSubjects.click('docTableExpandToggleColumn');
const angularTab = await find.byButtonText('Angular doc view');
const reactTab = await find.byButtonText('React doc view');
expect(await angularTab.isDisplayed()).to.be(true);
expect(await reactTab.isDisplayed()).to.be(true);
});

it('should render angular doc view', async () => {
const angularTab = await find.byButtonText('Angular doc view');
await angularTab.click();
const angularContent = await testSubjects.find('angular-docview');
expect(await angularContent.getVisibleText()).to.be('logstash-2015.09.22');
});

it('should render react doc view', async () => {
const reactTab = await find.byButtonText('React doc view');
await reactTab.click();
Expand Down

0 comments on commit 03bc3cc

Please sign in to comment.