-
Notifications
You must be signed in to change notification settings - Fork 149
fix: Replace custom language names list with standard Intl DisplayNames API #2332 #2371
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
import React from 'react'; | ||
import { | ||
render, screen, initializeMocks, fireEvent, | ||
render, screen, initializeMocks, | ||
} from '@src/testUtils'; | ||
import LanguageSelector from './LanguageSelector'; | ||
import { selectors } from '../../../../../../data/redux'; | ||
|
@@ -13,19 +13,22 @@ const lang3 = 'sImLisH'; | |
const lang3Code = 'sl'; | ||
|
||
jest.mock('../../../../../../data/constants/video', () => ({ | ||
videoTranscriptLanguages: { | ||
[lang1Code]: lang1, | ||
[lang2Code]: lang2, | ||
[lang3Code]: lang3, | ||
}, | ||
getLanguageName: jest.fn((code) => { | ||
const mockMap = { | ||
kl: lang1, | ||
el: lang2, | ||
sl: lang3, | ||
}; | ||
return mockMap[code] || code; | ||
}), | ||
})); | ||
|
||
describe('LanguageSelector', () => { | ||
const props = { | ||
onSelect: jest.fn().mockName('props.OnSelect'), | ||
index: 1, | ||
language: lang1Code, | ||
openLanguages: [[lang2Code, lang2], [lang3Code, lang3]], | ||
openLanguages: [lang2Code, lang3Code, lang1Code], | ||
}; | ||
beforeEach(() => { | ||
initializeMocks(); | ||
|
@@ -46,13 +49,4 @@ describe('LanguageSelector', () => { | |
render(<LanguageSelector {...props} language="" />); | ||
expect(screen.getByText('Select Language')).toBeInTheDocument(); | ||
}); | ||
|
||
test('transcripts no Open Languages, all dropdown items should be disabled', () => { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why is this test no longer needed? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is reason we dont have disable option in our current implementation that is reason I have removed it |
||
const { video } = selectors; | ||
jest.spyOn(video, 'openLanguages').mockReturnValue([]); | ||
const { container } = render(<LanguageSelector {...props} language="" />); | ||
fireEvent.click(screen.getByRole('button', { name: 'Languages' })); | ||
const disabledItems = container.querySelectorAll('.disabled.dropdown-item'); | ||
expect(disabledItems.length).toBe(3); | ||
}); | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please leave this comment in place; I think it's helpful.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok