Open msmith1114 opened 7 years ago
Teaspoon.Fixture.prototype.load = function(url) {
return fetch(url)
.then(response => {
if (!response.ok) {
throw new Error('Network response was not ok');
}
return response.text();
})
.then(html => {
// Here you might want to append the HTML to the DOM or something similar
console.log(html);
return html;
})
.catch(error => {
console.error('There has been a problem with your fetch operation:', error);
});
};
// Usage
Teaspoon.Fixture.load('path/to/fixture.html').then(content => {
// Use the fixture content as needed
console.log(content);
});
I just noticed when doing some browser logging that im getting this:
XMLHttpRequest on the main thread is deprecated because of its detrimental effects to the end user's experience.
looking in deeper it's referring to
Fixture.load
Am I doing something wrong by using
Fixture.load('name of file here')
to use in my tests, is there another way that I should be using?Thanks