Field textinput pixel perfect input (#3443)

* Fix sizing of text input field in zelos, pixel perfect input in other browsers
This commit is contained in:
Sam El-Husseini
2019-11-14 16:13:22 -08:00
committed by GitHub
parent d8476306f4
commit 139382e009
8 changed files with 31 additions and 39 deletions

View File

@@ -201,10 +201,14 @@ suite('Angle Fields', function() {
this.angleField.htmlInput_ = Object.create(null);
this.angleField.htmlInput_.oldValue_ = '1';
this.angleField.htmlInput_.untypedDefaultValue_ = 1;
this.stub = sinon.stub(this.angleField, 'resizeEditor_');
});
teardown(function() {
this.angleField.setValidator(null);
this.angleField.htmlInput_ = null;
if (this.stub) {
this.stub.restore();
}
});
suite('Null Validator', function() {
setup(function() {

View File

@@ -329,10 +329,14 @@ suite('Number Fields', function() {
this.numberField.htmlInput_ = Object.create(null);
this.numberField.htmlInput_.oldValue_ = '1';
this.numberField.htmlInput_.untypedDefaultValue_ = 1;
this.stub = sinon.stub(this.numberField, 'resizeEditor_');
});
teardown(function() {
this.numberField.setValidator(null);
this.numberField.htmlInput_ = null;
if (this.stub) {
this.stub.restore();
}
});
suite('Null Validator', function() {
setup(function() {

View File

@@ -161,10 +161,14 @@ suite('Text Input Fields', function() {
this.textInputField.htmlInput_ = Object.create(null);
this.textInputField.htmlInput_.oldValue_ = 'value';
this.textInputField.htmlInput_.untypedDefaultValue_ = 'value';
this.stub = sinon.stub(this.textInputField, 'resizeEditor_');
});
teardown(function() {
this.textInputField.setValidator(null);
Blockly.FieldTextInput.htmlInput_ = null;
if (this.stub) {
this.stub.restore();
}
});
suite('Null Validator', function() {
setup(function() {
@@ -233,6 +237,7 @@ suite('Text Input Fields', function() {
FIELD_TEXT_FONTWEIGHT: 'normal',
FIELD_TEXT_FONTFAMILY: 'sans-serif'
};
field.clickTarget_ = document.createElement('div');
Blockly.WidgetDiv.DIV = document.createElement('div');
this.stub = sinon.stub(field, 'resizeEditor_');
};

View File

@@ -38,9 +38,12 @@ suite('Procedures', function() {
context.defBlock.setFieldValue(startName, 'NAME');
context.callBlock = new Blockly.Block(this.workspace, context.callType);
context.callBlock.setFieldValue(startName, 'NAME');
context.stub = sinon.stub(
context.defBlock.getField('NAME'), 'resizeEditor_');
func.call(context);
context.defBlock.dispose();
context.callBlock.dispose();
context.stub.restore();
}
};
});