const editableFieldTests = (EditableComponent, props = {}) => {
  const EditableComponentWithContext = withContext(EditableComponent)
  const testbed = createTestbed(EditableComponentWithContext, {
    isValid: true,
    showError: () => {},
    hideError: () => {},
    ...props
  })

  shouldRenderComponent(
    testbed, {}, EditableComponentWithContext
  )

  describe('a11y tests', () => {
    it('should meet a11y standards', (done) => {
      testbed.render()
      // ignoring button-name because of the textcolor tinymce plugin
      testbed.checkA11yStandards(done, {
        ignores: [
          'aria-allowed-role', // TODO: remove this when canvas-rce is fixed
          'button-name'
        ]
      })
    })
  })
}

export default editableFieldTests
