// test/merging.test.js
window.testMerging = async function() {
const { Component, ___unsafeRefreshState, $ } = ApigoState;
console.log('Testing complex class/style merging (DataTable Resizer scenario)...');
Component.register('Resizer-Real', container => {
container.isVertical = true;
}, document.createRange().createContextualFragment('
').firstChild);
document.body.innerHTML = '';
___unsafeRefreshState(document.documentElement);
await new Promise(r => setTimeout(r, 50));
const inst = $('#res-inst');
// Note: in current implementation, component root replaces the custom tag or merges?
// Based on base project usage, it merges into the tag.
const classList = Array.from(inst.classList);
console.log('Final ClassList:', classList);
if (!classList.includes('ins-static') || !classList.includes('tpl-static')) {
throw new Error('Class merging failed');
}
const style = inst.getAttribute('style');
console.log('Final Style:', style);
if (!style.includes('color: blue') && !style.includes('color:blue')) throw new Error('Style merging failed');
console.log('Merging test passed');
return true;
}