quarc/tests/unit/test-style-injection.html

82 lines
2.7 KiB
HTML

<!DOCTYPE html>
<html lang="pl">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Test wstrzykiwania stylów - Quarc</title>
<style>
body {
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
max-width: 1200px;
margin: 0 auto;
padding: 20px;
background: #f5f5f5;
}
h1 {
color: #333;
border-bottom: 3px solid #4CAF50;
padding-bottom: 10px;
}
#console {
background: #1e1e1e;
color: #d4d4d4;
padding: 20px;
border-radius: 8px;
font-family: 'Courier New', monospace;
font-size: 14px;
line-height: 1.6;
white-space: pre-wrap;
max-height: 600px;
overflow-y: auto;
}
.summary {
margin-top: 20px;
padding: 15px;
background: white;
border-radius: 8px;
box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}
.success { color: #4CAF50; }
.error { color: #f44336; }
.warning { color: #ff9800; }
</style>
</head>
<body>
<h1>🧪 Test wstrzykiwania stylów - Quarc Framework</h1>
<div class="summary">
<p>Ten test sprawdza czy style są poprawnie wstrzykiwane z transformacją <code>:host</code> na <code>[_nghost-scopeId]</code></p>
<p><strong>Uwaga:</strong> Otwórz konsolę przeglądarki (F12) aby zobaczyć szczegółowe logi.</p>
</div>
<div id="console"></div>
<script type="module">
// Przechwytywanie console.log
const consoleDiv = document.getElementById('console');
const originalLog = console.log;
console.log = function(...args) {
originalLog.apply(console, args);
const message = args.join(' ');
const div = document.createElement('div');
if (message.includes('✅')) {
div.className = 'success';
} else if (message.includes('❌')) {
div.className = 'error';
} else if (message.includes('⚠️')) {
div.className = 'warning';
}
div.textContent = message;
consoleDiv.appendChild(div);
};
// Importuj i uruchom testy
import('./test-style-injection.js').catch(err => {
console.log('❌ Błąd ładowania testów:', err.message);
console.log('⚠️ Upewnij się, że plik test-style-injection.ts został skompilowany do .js');
});
</script>
</body>
</html>