I am trying to test my vuejs component via jest that contains materialize select. When performing a component test, I get the following error in materialize.js:
When I ran into this issue I was trying to create the whole dropdown list dynamically in JS. The fix for me was creating the list and any default list elements in HTML:
Then appending any dynamic values in JS:
contents.forEach(function(content) {
var buffer = "";
var template = $(buffer);
$(template).text(content);
$("select1").find("select").append(template);
});
$("select").formSelect();