/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
'use strict';
import { testTokenization } from './testRunner';
testTokenization(['html', 'css'], [
// Open Start Tag #1'
[{
line: '',
tokens: [
{ startIndex: 0, type: 'delimiter.html' },
{ startIndex: 1, type: '' }
]
}],
// Open Start Tag #4
[{
line: 'i ',
tokens: [
{ startIndex: 0, type: 'delimiter.html' },
{ startIndex: 1, type: 'tag.html' },
{ startIndex: 4, type: 'delimiter.html' }
]
}],
// Complete Start Tag with Whitespace
[{
line: '',
tokens: [
{ startIndex: 0, type: 'delimiter.html' },
{ startIndex: 1, type: 'tag.html' },
{ startIndex: 4, type: '' },
{ startIndex: 5, type: 'delimiter.html' }
]
}],
// bug 9809 - Complete Start Tag with Namespaceprefix
[{
line: '',
tokens: [
{ startIndex: 0, type: 'delimiter.html' },
{ startIndex: 1, type: 'tag.html' },
{ startIndex: 8, type: 'delimiter.html' }
]
}],
// Complete End Tag
[{
line: '',
tokens: [
{ startIndex: 0, type: 'delimiter.html' },
{ startIndex: 2, type: 'tag.html' },
{ startIndex: 5, type: 'delimiter.html' }
]
}],
// Complete End Tag with Whitespace
[{
line: '',
tokens: [
{ startIndex: 0, type: 'delimiter.html' },
{ startIndex: 2, type: 'tag.html' },
{ startIndex: 5, type: '' },
{ startIndex: 7, type: 'delimiter.html' }
]
}],
// Empty Tag
[{
line: '',
tokens: [
{ startIndex: 0, type: 'delimiter.html' },
{ startIndex: 1, type: 'tag.html' },
{ startIndex: 4, type: '' },
{ startIndex: 5, type: 'delimiter.html' }
]
}],
// Embedded Content #1
[{
line: '',
tokens: [
{ startIndex: 0, type: 'delimiter.html' },
{ startIndex: 1, type: 'tag.html' },
{ startIndex: 7, type: '' },
{ startIndex: 8, type: 'attribute.name.html' },
{ startIndex: 12, type: 'delimiter.html' },
{ startIndex: 13, type: 'attribute.value.html' },
{ startIndex: 30, type: 'delimiter.html' },
{ startIndex: 31, type: '' },
{ startIndex: 41, type: 'delimiter.html' },
{ startIndex: 43, type: 'tag.html' },
{ startIndex: 49, type: 'delimiter.html' }
]
}],
// Embedded Content #2
[{
line: '',
tokens: [
{ startIndex: 0, type: 'delimiter.html' },
{ startIndex: 2, type: 'tag.html' },
{ startIndex: 8, type: 'delimiter.html' }
]
}],
// Embedded Content #3
[{
line: '',
tokens: [
{ startIndex: 0, type: 'delimiter.html' },
{ startIndex: 2, type: 'tag.html' },
{ startIndex: 8, type: 'delimiter.html' }
]
}],
// Embedded Content #4
[{
line: '',
tokens: [
{ startIndex: 0, type: '' },
{ startIndex: 10, type: 'delimiter.html' },
{ startIndex: 12, type: 'tag.html' },
{ startIndex: 18, type: 'delimiter.html' }
]
}],
// Embedded Content #5
[{
line: '',
tokens: [
{ startIndex: 0, type: '' },
{ startIndex: 2, type: 'delimiter.html' },
{ startIndex: 4, type: 'tag.html' },
{ startIndex: 10, type: 'delimiter.html' }
]
}],
// Embedded Content #6
[{
line: '',
tokens: [
{ startIndex: 0, type: 'delimiter.html' },
{ startIndex: 1, type: 'tag.html' },
{ startIndex: 7, type: 'delimiter.html' },
{ startIndex: 8, type: '' },
{ startIndex: 9, type: 'delimiter.html' },
{ startIndex: 11, type: 'tag.html' },
{ startIndex: 17, type: 'delimiter.html' },
// { startIndex:18, type: 'delimiter.html' },
{ startIndex: 19, type: 'tag.html' },
{ startIndex: 25, type: 'delimiter.html' },
{ startIndex: 26, type: '' },
{ startIndex: 27, type: 'delimiter.html' },
{ startIndex: 29, type: 'tag.html' },
{ startIndex: 35, type: 'delimiter.html' }
]
}],
// Embedded Content #7
[{
line: '',
tokens: [
{ startIndex: 0, type: 'delimiter.html' },
{ startIndex: 1, type: 'tag.html' },
{ startIndex: 7, type: '' },
{ startIndex: 8, type: 'attribute.name.html' },
{ startIndex: 12, type: 'delimiter.html' },
{ startIndex: 13, type: 'attribute.value.html' },
{ startIndex: 30, type: 'delimiter.html' },
// { startIndex:31, type: 'delimiter.html' },
{ startIndex: 33, type: 'tag.html' },
{ startIndex: 39, type: 'delimiter.html' }
]
}],
// Embedded Content #8
[{
line: '',
tokens: [
{ startIndex: 0, type: 'delimiter.html' },
{ startIndex: 1, type: 'tag.html' },
{ startIndex: 7, type: 'delimiter.html' },
{ startIndex: 8, type: '' },
{ startIndex: 18, type: 'delimiter.html' },
{ startIndex: 20, type: 'tag.html' },
{ startIndex: 26, type: 'delimiter.html' }
]
}],
// Embedded Content #9
[{
line: '',
tokens: [
{ startIndex: 0, type: 'delimiter.html' },
{ startIndex: 1, type: 'tag.html' },
{ startIndex: 7, type: '' },
{ startIndex: 8, type: 'attribute.name.html' },
{ startIndex: 12, type: 'delimiter.html' },
{ startIndex: 13, type: 'attribute.value.html' },
{ startIndex: 30, type: '' },
{ startIndex: 31, type: 'attribute.name.html' },
{ startIndex: 34, type: 'delimiter.html' },
{ startIndex: 35, type: 'attribute.value.html' },
{ startIndex: 44, type: 'delimiter.html' },
// { startIndex:45, type: 'delimiter.html' },
{ startIndex: 47, type: 'tag.html' },
{ startIndex: 53, type: 'delimiter.html' }
]
}],
// Tag with Attribute
[{
line: '',
tokens: [
{ startIndex: 0, type: 'delimiter.html' },
{ startIndex: 1, type: 'tag.html' },
{ startIndex: 4, type: '' },
{ startIndex: 5, type: 'attribute.name.html' },
{ startIndex: 8, type: 'delimiter.html' },
{ startIndex: 9, type: 'attribute.value.html' },
{ startIndex: 14, type: 'delimiter.html' }
]
}],
// Tag with Empty Attribute Value
[{
line: '',
tokens: [
{ startIndex: 0, type: 'delimiter.html' },
{ startIndex: 1, type: 'tag.html' },
{ startIndex: 4, type: '' },
{ startIndex: 5, type: 'attribute.name.html' },
{ startIndex: 8, type: 'delimiter.html' },
{ startIndex: 9, type: 'attribute.value.html' },
{ startIndex: 14, type: 'delimiter.html' }
]
}],
// Tag with empty attributes
[{
line: '',
tokens: [
{ startIndex: 0, type: 'delimiter.html' },
{ startIndex: 1, type: 'tag.html' },
{ startIndex: 4, type: '' },
{ startIndex: 5, type: 'attribute.name.html' },
{ startIndex: 8, type: 'delimiter.html' },
{ startIndex: 9, type: 'attribute.value.html' },
{ startIndex: 11, type: 'delimiter.html' }
]
}],
// Tag with Attributes
[{
line: '',
tokens: [
{ startIndex: 0, type: 'delimiter.html' },
{ startIndex: 1, type: 'tag.html' },
{ startIndex: 4, type: '' },
{ startIndex: 5, type: 'attribute.name.html' },
{ startIndex: 8, type: 'delimiter.html' },
{ startIndex: 9, type: 'attribute.value.html' },
{ startIndex: 14, type: '' },
{ startIndex: 15, type: 'attribute.name.html' },
{ startIndex: 18, type: 'delimiter.html' },
{ startIndex: 19, type: 'attribute.value.html' },
{ startIndex: 24, type: 'delimiter.html' }
]
}],
// Tag with Attributes, no quotes
[{
line: '',
tokens: [
{ startIndex: 0, type: 'delimiter.html' },
{ startIndex: 1, type: 'tag.html' },
{ startIndex: 4, type: '' },
{ startIndex: 5, type: 'attribute.name.html' },
{ startIndex: 8, type: 'delimiter.html' },
{ startIndex: 9, type: 'attribute.name.html' }, // slightly incorrect
{ startIndex: 12, type: '' },
{ startIndex: 13, type: 'attribute.name.html' },
{ startIndex: 16, type: 'delimiter.html' },
{ startIndex: 17, type: 'attribute.name.html' }, // slightly incorrect
{ startIndex: 24, type: 'delimiter.html' }
]
}],
// Tag with Attribute And Whitespace
[{
line: '',
tokens: [
{ startIndex: 0, type: 'delimiter.html' },
{ startIndex: 1, type: 'tag.html' },
{ startIndex: 4, type: '' },
{ startIndex: 5, type: 'attribute.name.html' },
{ startIndex: 8, type: 'delimiter.html' },
{ startIndex: 9, type: '' },
{ startIndex: 11, type: 'attribute.value.html' },
{ startIndex: 16, type: 'delimiter.html' }
]
}],
// Tag with Attribute And Whitespace #2
[{
line: '',
tokens: [
{ startIndex: 0, type: 'delimiter.html' },
{ startIndex: 1, type: 'tag.html' },
{ startIndex: 4, type: '' },
{ startIndex: 5, type: 'attribute.name.html' },
{ startIndex: 8, type: '' },
{ startIndex: 9, type: 'delimiter.html' },
{ startIndex: 10, type: '' },
{ startIndex: 11, type: 'attribute.value.html' },
{ startIndex: 16, type: 'delimiter.html' }
]
}],
// Tag with Name-Only-Attribute #1
[{
line: '',
tokens: [
{ startIndex: 0, type: 'delimiter.html' },
{ startIndex: 1, type: 'tag.html' },
{ startIndex: 4, type: '' },
{ startIndex: 5, type: 'attribute.name.html' },
{ startIndex: 8, type: 'delimiter.html' }
]
}],
// Tag with Name-Only-Attribute #2
[{
line: '',
tokens: [
{ startIndex: 0, type: 'delimiter.html' },
{ startIndex: 1, type: 'tag.html' },
{ startIndex: 4, type: '' },
{ startIndex: 5, type: 'attribute.name.html' },
{ startIndex: 8, type: '' },
{ startIndex: 9, type: 'attribute.name.html' },
{ startIndex: 12, type: 'delimiter.html' }
]
}],
// Tag with Interesting Attribute Name
[{
line: '',
tokens: [
{ startIndex: 0, type: 'delimiter.html' },
{ startIndex: 1, type: 'tag.html' },
{ startIndex: 4, type: '' },
{ startIndex: 5, type: 'attribute.name.html' },
{ startIndex: 8, type: '' },
{ startIndex: 11, type: 'delimiter.html' },
{ startIndex: 12, type: 'attribute.value.html' },
{ startIndex: 17, type: 'delimiter.html' }
]
}],
// Tag with Angular Attribute Name
[{
line: '',
tokens: [
{ startIndex: 0, type: 'delimiter.html' },
{ startIndex: 1, type: 'tag.html' },
{ startIndex: 4, type: '' },
{ startIndex: 6, type: 'attribute.name.html' },
{ startIndex: 13, type: '' },
{ startIndex: 15, type: 'attribute.name.html' },
{ startIndex: 20, type: '' },
{ startIndex: 21, type: 'delimiter.html' },
{ startIndex: 22, type: 'attribute.value.html' },
{ startIndex: 27, type: '' },
{ startIndex: 29, type: 'attribute.name.html' },
{ startIndex: 34, type: '' },
{ startIndex: 35, type: 'delimiter.html' },
{ startIndex: 36, type: 'attribute.value.html' },
{ startIndex: 50, type: '' },
{ startIndex: 52, type: 'attribute.name.html' },
{ startIndex: 56, type: 'delimiter.html' },
{ startIndex: 57, type: 'attribute.value.html' },
{ startIndex: 72, type: 'delimiter.html' }
]
}],
// Tag with Invalid Attribute Value
[{
line: '',
tokens: [
{ startIndex: 0, type: 'metatag.content.html' },
{ startIndex: 11, type: 'metatag.html' }
]
}],
// PR #14
[{
line: 'asd',
tokens: [
{ startIndex: 0, type: 'delimiter.html' },
{ startIndex: 1, type: 'tag.html' },
{ startIndex: 9, type: 'delimiter.html' },
{ startIndex: 10, type: '' },
{ startIndex: 13, type: 'delimiter.html' },
{ startIndex: 15, type: 'tag.html' },
{ startIndex: 23, type: 'delimiter.html' }
]
}]
]);