Skip to content
Snippets Groups Projects
Commit 6535caed authored by Albin Henriksson's avatar Albin Henriksson
Browse files

Fix tests

parent abd52f40
No related branches found
No related tags found
1 merge request!65Resolve "Use component api in editor"
Pipeline #41063 passed with warnings
......@@ -13,7 +13,7 @@ it('renders presentation editor', () => {
id: 0,
year: 0,
city_id: 0,
slides: [],
slides: [{ id: 5 }],
teams: [],
},
}
......
......@@ -9,9 +9,9 @@ import TextComponentDisplay from './TextComponentDisplay'
const SlideEditor: React.FC = () => {
const components = useAppSelector(
(state) => state.editor.competition.slides.find((slide) => slide.id === state.editor.activeSlideId)?.components
(state) =>
state.editor.competition.slides.find((slide) => slide && slide.id === state.editor.activeSlideId)?.components
)
console.log(components)
return (
<SlideEditorContainer>
{components &&
......
......@@ -205,7 +205,8 @@ const SlideSettings: React.FC = () => {
secondary="(Fyll i rutan höger om textfältet för att markera korrekt svar)"
/>
</ListItem>
{currentSlide.questions[0] &&
{currentSlide &&
currentSlide.questions[0] &&
currentSlide.questions[0].question_alternatives.map((alt) => (
<div key={alt.id}>
<ListItem divider>
......
import { Editor } from '@tinymce/tinymce-react'
import { mount } from 'enzyme'
import React from 'react'
import { Provider } from 'react-redux'
import store from '../../../store'
import TextComponentDisplay from './TextComponentDisplay'
it('renders text component display', () => {
const testText = 'TEST'
const container = mount(
<TextComponentDisplay component={{ id: 0, x: 0, y: 0, w: 0, h: 0, text: testText, type: 2, font: '123123' }} />
<Provider store={store}>
<TextComponentDisplay
component={{ id: 0, x: 0, y: 0, w: 0, h: 0, data: { text: testText, font: '123123' }, type_id: 2 }}
/>
</Provider>
)
expect(container.find(Editor).prop('initialValue')).toBe(testText)
})
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment