|
|
@@ -1,8 +1,9 @@
|
|
|
import { expect } from 'chai'
|
|
|
import { fireEvent, render, screen } from '@testing-library/react'
|
|
|
-import SurveyWidget from '../../../../../frontend/js/features/project-list/components/survey-widget'
|
|
|
+import { SurveyWidgetDsNav } from '../../../../../frontend/js/features/project-list/components/survey-widget-ds-nav'
|
|
|
+import { SplitTestProvider } from '@/shared/context/split-test-context'
|
|
|
|
|
|
-describe('<SurveyWidget />', function () {
|
|
|
+describe('<SurveyWidgetDsNav />', function () {
|
|
|
beforeEach(function () {
|
|
|
this.name = 'my-survey'
|
|
|
this.preText = 'To help shape the future of Overleaf'
|
|
|
@@ -21,7 +22,11 @@ describe('<SurveyWidget />', function () {
|
|
|
url: this.url,
|
|
|
})
|
|
|
|
|
|
- render(<SurveyWidget />)
|
|
|
+ render(
|
|
|
+ <SplitTestProvider>
|
|
|
+ <SurveyWidgetDsNav />
|
|
|
+ </SplitTestProvider>
|
|
|
+ )
|
|
|
})
|
|
|
|
|
|
it('shows text and link', function () {
|
|
|
@@ -29,9 +34,10 @@ describe('<SurveyWidget />', function () {
|
|
|
expect(dismissed).to.equal(null)
|
|
|
|
|
|
screen.getByText(this.preText)
|
|
|
+ screen.getByText(this.linkText)
|
|
|
|
|
|
const link = screen.getByRole('link', {
|
|
|
- name: this.linkText,
|
|
|
+ name: 'Take survey',
|
|
|
}) as HTMLAnchorElement
|
|
|
expect(link.href).to.equal(this.url)
|
|
|
})
|
|
|
@@ -63,7 +69,11 @@ describe('<SurveyWidget />', function () {
|
|
|
})
|
|
|
localStorage.setItem('dismissed-my-survey', 'true')
|
|
|
|
|
|
- render(<SurveyWidget />)
|
|
|
+ render(
|
|
|
+ <SplitTestProvider>
|
|
|
+ <SurveyWidgetDsNav />
|
|
|
+ </SplitTestProvider>
|
|
|
+ )
|
|
|
})
|
|
|
|
|
|
it('nothing is displayed', function () {
|
|
|
@@ -77,7 +87,11 @@ describe('<SurveyWidget />', function () {
|
|
|
|
|
|
describe('survey widget is not shown when no survey is configured', function () {
|
|
|
beforeEach(function () {
|
|
|
- render(<SurveyWidget />)
|
|
|
+ render(
|
|
|
+ <SplitTestProvider>
|
|
|
+ <SurveyWidgetDsNav />
|
|
|
+ </SplitTestProvider>
|
|
|
+ )
|
|
|
})
|
|
|
|
|
|
it('nothing is displayed', function () {
|