mirror of
https://github.com/Microsoft/vscode
synced 2024-08-28 05:19:39 +00:00
colorize tests: add color, normalize type
This commit is contained in:
parent
4431fb83c1
commit
3a486b145e
|
@ -25,9 +25,7 @@ function assertUnchangedTokens(testFixurePath:string, done) {
|
|||
try {
|
||||
assert.deepEqual(data, previousData);
|
||||
} catch (e) {
|
||||
fs.writeFileSync(resultPath, JSON.stringify(data, null, '\t'), { mode: 'w' });
|
||||
let errorResultPath = join(resultsFolderPath, fileName.replace('.', '_') + '.previous.json');
|
||||
fs.writeFileSync(errorResultPath, JSON.stringify(previousData, null, '\t'), { mode: 'w' });
|
||||
fs.writeFileSync(resultPath, JSON.stringify(data, null, '\t'), { flag: 'w' });
|
||||
throw e;
|
||||
}
|
||||
} else {
|
||||
|
|
|
@ -57,9 +57,13 @@ class Snapper {
|
|||
return element;
|
||||
}
|
||||
|
||||
private normalizeType(type: string) : string {
|
||||
return type.split('.').sort().join('.');
|
||||
}
|
||||
|
||||
private getStyle(testNode: Element, scope: string) : string {
|
||||
|
||||
testNode.className = 'token ' + scope;
|
||||
testNode.className = 'token ' + scope.replace(/\./g, ' ');
|
||||
|
||||
let cssStyles = window.getComputedStyle(testNode);
|
||||
if (cssStyles) {
|
||||
|
@ -110,7 +114,7 @@ class Snapper {
|
|||
let testNode = this.getTestNode(themeId);
|
||||
let themeName = getThemeName(themeId);
|
||||
data.forEach(entry => {
|
||||
entry.r[themeName] = this.getMatchedCSSRule(testNode, entry.t);
|
||||
entry.r[themeName] = this.getMatchedCSSRule(testNode, entry.t) + ' ' + this.getStyle(testNode, entry.t)
|
||||
});
|
||||
}
|
||||
});
|
||||
|
@ -133,7 +137,7 @@ class Snapper {
|
|||
let content = model.getValueInRange({ startLineNumber: lineNumber, endLineNumber: lineNumber, startColumn: tokenInfo.startColumn, endColumn: tokenInfo.endColumn});
|
||||
result.push({
|
||||
c: content,
|
||||
t: tokenInfo.token.type,
|
||||
t: this.normalizeType(tokenInfo.token.type),
|
||||
r: {}
|
||||
});
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue