@ordojs/core
Version:
Core compiler and runtime for OrdoJS framework
41 lines (32 loc) • 1.29 kB
text/typescript
/**
* @fileoverview Debug HTML attribute tokenization
*/
import { describe, expect, it } from 'vitest';
import { OrdoJSLexer } from './lexer.js';
describe('Debug Attribute Tokens', () => {
it('should show tokens for HTML with attributes', () => {
const source = `
component TestComponent {
markup {
<div class="test" id="main">Hello</div>
}
}
`;
const lexer = new OrdoJSLexer(source, 'test.ordo');
const tokens = lexer.tokenize();
// Find the HTML section
const htmlStartIndex = tokens.tokens.findIndex(t => t.type === 'HTML_TAG_OPEN' && t.value === '<');
const htmlTokens = tokens.tokens.slice(htmlStartIndex, htmlStartIndex + 15);
console.log('HTML tokens with attributes:');
htmlTokens.forEach((token, i) => {
console.log(` ${htmlStartIndex + i}: ${token.type} = "${token.value}"`);
});
// Check if HTML_ATTRIBUTE tokens exist
const hasHTMLAttributeTokens = tokens.tokens.some(t => t.type === 'HTML_ATTRIBUTE');
console.log('\nHas HTML_ATTRIBUTE tokens:', hasHTMLAttributeTokens);
// Show all token types
const tokenTypes = [...new Set(tokens.tokens.map(t => t.type))];
console.log('\nAll token types found:', tokenTypes);
expect(true).toBe(true);
});
});