Auth UI Kit Tests
Password Validation Tests
") === "helloscriptalert('xss')/script"),
() => runTest("Trim whitespace", () => sanitizeInput(" hello world ") === "hello world"),
() => runTest("Handle empty string", () => sanitizeInput("") === ""),
() => runTest("Handle normal text", () => sanitizeInput("normal text") === "normal text"),
() => runTest("Remove only < and >", () => sanitizeInput("test<>test") === "testtest"),
];
// Run all tests
document.getElementById('email-tests').innerHTML = emailTests.map(test => test()).join('');
document.getElementById('password-tests').innerHTML = passwordTests.map(test => test()).join('');
document.getElementById('sanitization-tests').innerHTML = sanitizationTests.map(test => test()).join('');
// Display summary
const passRate = ((passedTests / totalTests) * 100).toFixed(1);
const summaryColor = passRate === '100.0' ? 'text-green-600' : passRate >= '80.0' ? 'text-yellow-600' : 'text-red-600';
document.getElementById('test-summary').innerHTML = `
${passedTests}/${totalTests} tests passed (${passRate}%)
${passRate === '100.0' ? '🎉 All tests passed!' : passRate >= '80.0' ? '⚠️ Most tests passed' : '❌ Some tests failed'}
These tests validate the core security and validation functions of the enhanced auth UI kit.
`;