Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion react-migration-toolkit/src/react/contexts/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
export { LDProvider, type LDFlagSet } from './launchdarkly-context';
export { PolymorphicRouterContextProvider } from './polymorphic-router-context';
export { PolymorphicNavigateProvider } from './polymorphic-navigate-context';
export { ApplicationProvider } from './application-context';

This file was deleted.

1 change: 0 additions & 1 deletion react-migration-toolkit/src/react/hooks/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
export { useEmberService } from './use-ember-service';
export { useApplicationInstance } from './use-application-instance';
export { useFlags } from './use-flags';
export { useNavigate } from './use-navigate';
export { useRouter } from './use-router';
30 changes: 0 additions & 30 deletions react-migration-toolkit/src/react/hooks/use-flags.ts

This file was deleted.

14 changes: 0 additions & 14 deletions test-app/app/react/custom-providers-with-ld.tsx

This file was deleted.

16 changes: 0 additions & 16 deletions test-app/app/react/example-ld.tsx

This file was deleted.

49 changes: 0 additions & 49 deletions test-app/tests/integration/components/react-bridge-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,8 @@ import { htmlSafe } from '@ember/template';
import { setupRenderingTest } from 'test-app/tests/helpers';
import { Example } from 'test-app/react/example';
import { ExampleIntl } from 'test-app/react/exampleIntl';
import { ExampleWithLD } from 'test-app/react/example-ld';
import { CustomProviders } from 'test-app/react/custom-providers';
import { CustomProvidersWithLD } from 'test-app/react/custom-providers-with-ld';
import { setupIntl } from 'ember-intl/test-support';
import { setupLaunchDarkly } from 'ember-launch-darkly/test-support';
import { getCurrentContext } from 'ember-launch-darkly/-sdk/context';

module('Integration | Component | react-bridge', function (hooks) {
setupRenderingTest(hooks);
Expand Down Expand Up @@ -183,51 +179,6 @@ module('Integration | Component | react-bridge', function (hooks) {
assert.dom(this.element).hasText('Willkommen in React!');
});

module('when LDProvider is part of custom providers', function (hooks) {
setupLaunchDarkly(hooks);

hooks.beforeEach(async function () {
this.customProvidersComponent = CustomProvidersWithLD;
this.reactExample = ExampleWithLD;

this.context = getCurrentContext();
});

test('it can access flags via useFlags hook', async function (assert) {
await this.withVariation('feature--experiment-a', true);
await render(hbs`
<ReactBridge
@reactComponent={{this.reactExample}}
@providerOptions={{hash
component=this.customProvidersComponent
props=(hash ldFlags=this.context.allFlags)
}}
/>
`);

assert.dom('[data-test-feature-experiment-a]').exists();
});

test('it re-renders when a flag changes', async function (assert) {
await this.withVariation('feature--experiment-a', true);
await render(hbs`
<ReactBridge
@reactComponent={{this.reactExample}}
@providerOptions={{hash
component=this.customProvidersComponent
props=(hash ldFlags=this.context.allFlags)
}}
/>
`);

assert.dom('[data-test-feature-experiment-a]').exists();

await this.withVariation('feature--experiment-a', false);

assert.dom('[data-test-feature-experiment-a]').doesNotExist();
});
});

test('it defaults to a div if no tag name is passed as a prop', async function (assert) {
await render(hbs`
<ReactBridge @reactComponent={{this.reactExample}} />
Expand Down