'Test if a web component is found in config panels dir.'

@patch('homeassistant.components.panel_custom.register_panel')
def test_webcomponent_in_panels_dir(self, mock_register, _mock_setup):

    config = {'panel_custom': {'name': 'todomvc'}}
    assert (not setup.setup_component(self.hass, 'panel_custom', config))
    assert (not mock_register.called)
    path = self.hass.config.path(panel_custom.PANEL_DIR)
    os.mkdir(path)
    self.hass.data.pop(setup.DATA_SETUP)
    with open(os.path.join(path, 'todomvc.html'), 'a'):
        assert setup.setup_component(self.hass, 'panel_custom', config)
        assert mock_register.called
