Refresh Emmet updateImageSize tests

Fixes #138499
This commit is contained in:
Raymond Zhao
2021-12-07 13:41:09 -08:00
parent 9acd320eda
commit 21e0035bdb
6 changed files with 80 additions and 75 deletions

View File

@@ -9,22 +9,26 @@ import { Selection } from 'vscode';
import { withRandomFileEditor, closeAllEditors } from './testUtils';
import { updateImageSize } from '../updateImageSize';
suite.skip('Tests for Emmet actions on html tags', () => {
suite('Tests for Emmet actions on html tags', () => {
teardown(closeAllEditors);
const imageUrl = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAIAAAACCAIAAAD91JpzAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAAHYcAAB2HAY/l8WUAAAATSURBVBhXY/jPwADGDP////8PAB/uBfuDMzhuAAAAAElFTkSuQmCC';
const imageWidth = 2;
const imageHeight = 2;
test('update image css with multiple cursors in css file', () => {
const cssContents = `
.one {
margin: 10px;
padding: 10px;
background-image: url(https://raw.githubusercontent.com/microsoft/vscode/master/resources/linux/code.png);
background-image: url('${imageUrl}');
}
.two {
background-image: url(https://raw.githubusercontent.com/microsoft/vscode/master/resources/linux/code.png);
background-image: url('${imageUrl}');
height: 42px;
}
.three {
background-image: url(https://raw.githubusercontent.com/microsoft/vscode/master/resources/linux/code.png);
background-image: url('${imageUrl}');
width: 42px;
}
`;
@@ -32,19 +36,19 @@ suite.skip('Tests for Emmet actions on html tags', () => {
.one {
margin: 10px;
padding: 10px;
background-image: url(https://raw.githubusercontent.com/microsoft/vscode/master/resources/linux/code.png);
width: 1024px;
height: 1024px;
background-image: url('${imageUrl}');
width: ${imageWidth}px;
height: ${imageHeight}px;
}
.two {
background-image: url(https://raw.githubusercontent.com/microsoft/vscode/master/resources/linux/code.png);
width: 1024px;
height: 1024px;
background-image: url('${imageUrl}');
width: ${imageWidth}px;
height: ${imageHeight}px;
}
.three {
background-image: url(https://raw.githubusercontent.com/microsoft/vscode/master/resources/linux/code.png);
height: 1024px;
width: 1024px;
background-image: url('${imageUrl}');
height: ${imageHeight}px;
width: ${imageWidth}px;
}
`;
return withRandomFileEditor(cssContents, 'css', (editor, doc) => {
@@ -68,14 +72,14 @@ suite.skip('Tests for Emmet actions on html tags', () => {
.one {
margin: 10px;
padding: 10px;
background-image: url(https://raw.githubusercontent.com/microsoft/vscode/master/resources/linux/code.png);
background-image: url('${imageUrl}');
}
.two {
background-image: url(https://raw.githubusercontent.com/microsoft/vscode/master/resources/linux/code.png);
background-image: url('${imageUrl}');
height: 42px;
}
.three {
background-image: url(https://raw.githubusercontent.com/microsoft/vscode/master/resources/linux/code.png);
background-image: url('${imageUrl}');
width: 42px;
}
</style>
@@ -87,19 +91,19 @@ suite.skip('Tests for Emmet actions on html tags', () => {
.one {
margin: 10px;
padding: 10px;
background-image: url(https://raw.githubusercontent.com/microsoft/vscode/master/resources/linux/code.png);
width: 1024px;
height: 1024px;
background-image: url('${imageUrl}');
width: ${imageWidth}px;
height: ${imageHeight}px;
}
.two {
background-image: url(https://raw.githubusercontent.com/microsoft/vscode/master/resources/linux/code.png);
width: 1024px;
height: 1024px;
background-image: url('${imageUrl}');
width: ${imageWidth}px;
height: ${imageHeight}px;
}
.three {
background-image: url(https://raw.githubusercontent.com/microsoft/vscode/master/resources/linux/code.png);
height: 1024px;
width: 1024px;
background-image: url('${imageUrl}');
height: ${imageHeight}px;
width: ${imageWidth}px;
}
</style>
</html>
@@ -121,16 +125,16 @@ suite.skip('Tests for Emmet actions on html tags', () => {
test('update image size in img tag in html file with multiple cursors', () => {
const htmlwithimgtag = `
<html>
<img id="one" src="https://raw.githubusercontent.com/microsoft/vscode/master/resources/linux/code.png" />
<img id="two" src="https://raw.githubusercontent.com/microsoft/vscode/master/resources/linux/code.png" width="56" />
<img id="three" src="https://raw.githubusercontent.com/microsoft/vscode/master/resources/linux/code.png" height="56" />
<img id="one" src="${imageUrl}" />
<img id="two" src="${imageUrl}" width="56" />
<img id="three" src="${imageUrl}" height="56" />
</html>
`;
const expectedContents = `
<html>
<img id="one" src="https://raw.githubusercontent.com/microsoft/vscode/master/resources/linux/code.png" width="1024" height="1024" />
<img id="two" src="https://raw.githubusercontent.com/microsoft/vscode/master/resources/linux/code.png" width="1024" height="1024" />
<img id="three" src="https://raw.githubusercontent.com/microsoft/vscode/master/resources/linux/code.png" height="1024" width="1024" />
<img id="one" src="${imageUrl}" width="${imageWidth}" height="${imageHeight}" />
<img id="two" src="${imageUrl}" width="${imageWidth}" height="${imageHeight}" />
<img id="three" src="${imageUrl}" height="${imageHeight}" width="${imageWidth}" />
</html>
`;
return withRandomFileEditor(htmlwithimgtag, 'html', (editor, doc) => {