From 888e348c691e6b7da6811f171d861dd967bc7096 Mon Sep 17 00:00:00 2001 From: Sam El-Husseini Date: Wed, 6 May 2020 09:42:24 -0700 Subject: [PATCH] Clean out the date field (#3876) --- core/field_date.js | 344 ------------------- core/requires.js | 7 - demos/blockfactory/blocks.js | 18 - demos/blockfactory/factory_utils.js | 17 - demos/blockfactory/index.html | 5 - demos/blockfactory_old/blocks.js | 18 - demos/blockfactory_old/factory.js | 17 - demos/blockfactory_old/index.html | 5 - tests/blocks/test_blocks.js | 17 - tests/mocha/field_date_test.js | 173 ---------- tests/mocha/index.html | 1 - tests/mocha/xml_test.js | 22 -- tests/screenshot/test_cases/test_fields_date | 3 - typings/blockly.d.ts | 12 - 14 files changed, 659 deletions(-) delete mode 100644 core/field_date.js delete mode 100644 tests/mocha/field_date_test.js delete mode 100644 tests/screenshot/test_cases/test_fields_date diff --git a/core/field_date.js b/core/field_date.js deleted file mode 100644 index aaed6bfa4..000000000 --- a/core/field_date.js +++ /dev/null @@ -1,344 +0,0 @@ -/** - * @license - * Copyright 2015 Google LLC - * SPDX-License-Identifier: Apache-2.0 - */ - -/** - * @fileoverview Date input field. - * @author pkendall64@gmail.com (Paul Kendall) - */ -'use strict'; - -goog.provide('Blockly.FieldDate'); - -goog.require('Blockly.Css'); -goog.require('Blockly.Events'); -goog.require('Blockly.Field'); -goog.require('Blockly.fieldRegistry'); -goog.require('Blockly.utils.dom'); -goog.require('Blockly.utils.object'); -goog.require('Blockly.utils.string'); - -goog.require('goog.date'); -goog.require('goog.date.DateTime'); -goog.require('goog.events'); -goog.require('goog.i18n.DateTimeSymbols'); -goog.require('goog.i18n.DateTimeSymbols_he'); -goog.require('goog.ui.DatePicker'); - - -/** - * Class for a date input field. - * @param {string=} opt_value The initial value of the field. Should be in - * 'YYYY-MM-DD' format. Defaults to the current date. - * @param {Function=} opt_validator A function that is called to validate - * changes to the field's value. Takes in a date string & returns a - * validated date string ('YYYY-MM-DD' format), or null to abort the change. - * @extends {Blockly.Field} - * @constructor - */ -Blockly.FieldDate = function(opt_value, opt_validator) { - Blockly.FieldDate.superClass_.constructor.call(this, - opt_value || new goog.date.Date().toIsoString(true), opt_validator); -}; -Blockly.utils.object.inherits(Blockly.FieldDate, Blockly.Field); - -/** - * Construct a FieldDate from a JSON arg object. - * @param {!Object} options A JSON object with options (date). - * @return {!Blockly.FieldDate} The new field instance. - * @package - * @nocollapse - */ -Blockly.FieldDate.fromJson = function(options) { - return new Blockly.FieldDate(options['date']); -}; - -/** - * Serializable fields are saved by the XML renderer, non-serializable fields - * are not. Editable fields should also be serializable. - * @type {boolean} - */ -Blockly.FieldDate.prototype.SERIALIZABLE = true; - -/** - * Mouse cursor style when over the hotspot that initiates the editor. - */ -Blockly.FieldDate.prototype.CURSOR = 'text'; - -/** - * Border colour for the dropdown div showing the date picker. Must be a CSS - * string. - * @type {string} - * @private - */ -Blockly.FieldDate.prototype.DROPDOWN_BORDER_COLOUR = 'silver'; - -/** - * Background colour for the dropdown div showing the date picker. Must be a - * CSS string. - * @type {string} - * @private - */ -Blockly.FieldDate.prototype.DROPDOWN_BACKGROUND_COLOUR = 'white'; - -/** - * Ensure that the input value is a valid date. - * @param {*=} opt_newValue The input value. - * @return {?string} A valid date, or null if invalid. - * @protected - */ -Blockly.FieldDate.prototype.doClassValidation_ = function(opt_newValue) { - if (!opt_newValue) { - return null; - } - // Check if the new value is parsable or not. - var date = goog.date.Date.fromIsoString(opt_newValue); - if (!date || date.toIsoString(true) != opt_newValue) { - return null; - } - return opt_newValue; -}; - -/** - * Render the field. If the picker is shown make sure it has the current - * date selected. - * @protected - */ -Blockly.FieldDate.prototype.render_ = function() { - Blockly.FieldDate.superClass_.render_.call(this); - if (this.picker_) { - this.picker_.setDate(goog.date.Date.fromIsoString(this.getValue())); - this.updateEditor_(); - } -}; - -/** - * Updates the field's colours to match those of the block. - * @package - */ -Blockly.FieldDate.prototype.applyColour = function() { - this.todayColour_ = this.sourceBlock_.style.colourPrimary; - this.selectedColour_ = this.sourceBlock_.style.colourSecondary; - this.updateEditor_(); -}; - -/** - * Updates the picker to show the current date and currently selected date. - * @private - */ -Blockly.FieldDate.prototype.updateEditor_ = function() { - if (!this.picker_) { - // Nothing to update. - return; - } - - // Updating today should come before updating selected, so that if the - // current day is selected, it will appear so. - if (this.oldTodayElement_) { - this.oldTodayElement_.style.backgroundColor = null; - this.oldTodayElement_.style.color = null; - } - var today = this.picker_.getElementByClass('goog-date-picker-today'); - this.oldTodayElement_ = today; - if (today) { - today.style.backgroundColor = this.todayColour_; - today.style.color = 'white'; - } - - if (this.oldSelectedElement_ && this.oldSelectedElement_ != today) { - this.oldSelectedElement_.style.backgroundColor = null; - this.oldSelectedElement_.style.color = null; - } - var selected = this.picker_.getElementByClass('goog-date-picker-selected'); - this.oldSelectedElement_ = selected; - if (selected) { - selected.style.backgroundColor = this.selectedColour_; - selected.style.color = this.todayColour_; - } -}; - -/** - * Create and show the date field's editor. - * @private - */ -Blockly.FieldDate.prototype.showEditor_ = function() { - this.picker_ = this.dropdownCreate_(); - this.picker_.render(Blockly.DropDownDiv.getContentDiv()); - Blockly.utils.dom.addClass(this.picker_.getElement(), 'blocklyDatePicker'); - Blockly.DropDownDiv.setColour( - this.DROPDOWN_BACKGROUND_COLOUR, this.DROPDOWN_BORDER_COLOUR); - - Blockly.DropDownDiv.showPositionedByField( - this, this.dropdownDispose_.bind(this)); - - this.updateEditor_(); -}; - -/** - * Create the date dropdown editor. - * @return {!goog.ui.DatePicker} The newly created date picker. - * @private - */ -Blockly.FieldDate.prototype.dropdownCreate_ = function() { - // Create the date picker using Closure. - Blockly.FieldDate.loadLanguage_(); - var picker = new goog.ui.DatePicker(); - picker.setAllowNone(false); - picker.setShowWeekNum(false); - picker.setUseNarrowWeekdayNames(true); - picker.setUseSimpleNavigationMenu(true); - picker.setDate(goog.date.DateTime.fromIsoString(this.getValue())); - - this.changeEventKey_ = goog.events.listen( - picker, - goog.ui.DatePicker.Events.CHANGE, - this.onDateSelected_, - null, - this); - this.activeMonthEventKey_ = goog.events.listen( - picker, - goog.ui.DatePicker.Events.CHANGE_ACTIVE_MONTH, - this.updateEditor_, - null, - this); - - return picker; -}; - -/** - * Dispose of references to DOM elements and events belonging - * to the date editor. - * @private - */ -Blockly.FieldDate.prototype.dropdownDispose_ = function() { - goog.events.unlistenByKey(this.changeEventKey_); - goog.events.unlistenByKey(this.activeMonthEventKey_); -}; - -/** - * Handle a CHANGE event in the date picker. - * @param {!Event} event The CHANGE event. - * @private - */ -Blockly.FieldDate.prototype.onDateSelected_ = function(event) { - var date = event.date ? event.date.toIsoString(true) : ''; - this.setValue(date); - Blockly.DropDownDiv.hideIfOwner(this); -}; - -/** - * Load the best language pack by scanning the Blockly.Msg object for a - * language that matches the available languages in Closure. - * @private - */ -Blockly.FieldDate.loadLanguage_ = function() { - for (var prop in goog.i18n) { - if (Blockly.utils.string.startsWith(prop, 'DateTimeSymbols_')) { - var lang = prop.substr(16).toLowerCase().replace('_', '.'); - // E.g. 'DateTimeSymbols_pt_BR' -> 'pt.br' - if (goog.getObjectByName(lang, Blockly.Msg)) { - goog.i18n.DateTimeSymbols = goog.i18n[prop]; - break; - } - } - } -}; - -/** - * CSS for date picker. See css.js for use. - */ -Blockly.Css.register([ - /* eslint-disable indent */ - '.blocklyDatePicker,', - '.blocklyDatePicker th,', - '.blocklyDatePicker td {', - 'font: 13px Arial, sans-serif;', - 'color: #3c4043;', - '}', - - '.blocklyDatePicker th,', - '.blocklyDatePicker td {', - 'text-align: center;', - 'vertical-align: middle;', - '}', - - '.blocklyDatePicker .goog-date-picker-wday,', - '.blocklyDatePicker .goog-date-picker-date {', - 'padding: 6px 6px;', - '}', - - '.blocklyDatePicker button {', - 'cursor: pointer;', - 'padding: 6px 6px;', - 'margin: 1px 0;', - 'border: 0;', - 'color: #3c4043;', - 'font-weight: bold;', - 'background: transparent;', - '}', - - '.blocklyDatePicker .goog-date-picker-previousMonth,', - '.blocklyDatePicker .goog-date-picker-nextMonth {', - 'height: 24px;', - 'width: 24px;', - '}', - - '.blocklyDatePicker .goog-date-picker-monthyear {', - 'font-weight: bold;', - '}', - - '.blocklyDatePicker .goog-date-picker-wday, ', - '.blocklyDatePicker .goog-date-picker-other-month {', - 'color: #70757a;', - 'border-radius: 12px;', - '}', - - '.blocklyDatePicker button,', - '.blocklyDatePicker .goog-date-picker-date {', - 'cursor: pointer;', - 'background-color: rgb(218, 220, 224, 0);', - 'border-radius: 12px;', - 'transition: background-color,opacity 100ms linear;', - '}', - - '.blocklyDatePicker button:hover,', - '.blocklyDatePicker .goog-date-picker-date:hover {', - 'background-color: rgb(218, 220, 224, .5);', - '}' - /* eslint-enable indent */ -]); - -Blockly.fieldRegistry.register('field_date', Blockly.FieldDate); - - -/** - * Back up original getMsg function. - * @type {!Function} - */ -goog.getMsgOrig = goog.getMsg; - -/** - * Gets a localized message. - * Overrides the default Closure function to check for a Blockly.Msg first. - * Used infrequently, only known case is TODAY button in date picker. - * @param {string} str Translatable string, places holders in the form {$foo}. - * @param {Object.=} opt_values Maps place holder name to value. - * @return {string} Message with placeholders filled. - * @suppress {duplicate} - */ -goog.getMsg = function(str, opt_values) { - var key = goog.getMsg.blocklyMsgMap[str]; - if (key) { - str = Blockly.Msg[key]; - } - return goog.getMsgOrig(str, opt_values); -}; - -/** - * Mapping of Closure messages to Blockly.Msg names. - */ -goog.getMsg.blocklyMsgMap = { - 'Today': 'TODAY' -}; diff --git a/core/requires.js b/core/requires.js index a9c87b5f6..d7008717f 100644 --- a/core/requires.js +++ b/core/requires.js @@ -63,13 +63,6 @@ goog.require('Blockly.FieldMultilineInput'); goog.require('Blockly.FieldNumber'); goog.require('Blockly.FieldVariable'); -// If you'd like to include the date field in your build, you will also need to -// include the Closure library as a build dependency. You can do so by running: -// gulp build-compressed --closure-library -// Be sure to also include "google-closure-library" to your list of -// devDependencies. -// goog.require('Blockly.FieldDate'); - // Blockly Renderers. // At least one renderer is mandatory. Geras is the default one. diff --git a/demos/blockfactory/blocks.js b/demos/blockfactory/blocks.js index c7253cc67..3cb7ca29b 100644 --- a/demos/blockfactory/blocks.js +++ b/demos/blockfactory/blocks.js @@ -559,24 +559,6 @@ Blockly.Blocks['field_colour'] = { } }; -Blockly.Blocks['field_date'] = { - // Date input. - init: function() { - this.setColour(160); - this.appendDummyInput() - .appendField('date') - .appendField(new Blockly.FieldDate(), 'DATE') - .appendField(',') - .appendField(new Blockly.FieldTextInput('NAME'), 'FIELDNAME'); - this.setPreviousStatement(true, 'Field'); - this.setNextStatement(true, 'Field'); - this.setTooltip('Date input field.'); - }, - onchange: function() { - fieldNameCheck(this); - } -}; - Blockly.Blocks['field_variable'] = { // Dropdown for variables. init: function() { diff --git a/demos/blockfactory/factory_utils.js b/demos/blockfactory/factory_utils.js index 8c1941d10..9044257dd 100644 --- a/demos/blockfactory/factory_utils.js +++ b/demos/blockfactory/factory_utils.js @@ -103,10 +103,6 @@ FactoryUtils.getGeneratorStub = function(block, generatorLanguage) { // Subclass of Blockly.FieldTextInput, must test first. code.push(makeVar('angle', name) + " = block.getFieldValue('" + name + "');"); - } else if (Blockly.FieldDate && field instanceof Blockly.FieldDate) { - // Blockly.FieldDate may not be compiled into Blockly. - code.push(makeVar('date', name) + - " = block.getFieldValue('" + name + "');"); } else if (field instanceof Blockly.FieldColour) { code.push(makeVar('colour', name) + " = block.getFieldValue('" + name + "');"); @@ -446,12 +442,6 @@ FactoryUtils.getFieldsJs_ = function(block) { '), ' + JSON.stringify(block.getFieldValue('FIELDNAME'))); break; - case 'field_date': - // Result: new Blockly.FieldDate('2015-02-04'), 'DATE' - fields.push('new Blockly.FieldDate(' + - JSON.stringify(block.getFieldValue('DATE')) + '), ' + - JSON.stringify(block.getFieldValue('FIELDNAME'))); - break; case 'field_variable': // Result: new Blockly.FieldVariable('item'), 'VAR' var varname @@ -561,13 +551,6 @@ FactoryUtils.getFieldsJson_ = function(block) { colour: block.getFieldValue('COLOUR') }); break; - case 'field_date': - fields.push({ - type: block.type, - name: block.getFieldValue('FIELDNAME'), - date: block.getFieldValue('DATE') - }); - break; case 'field_variable': fields.push({ type: block.type, diff --git a/demos/blockfactory/index.html b/demos/blockfactory/index.html index 0c1fc87b9..8241e1291 100644 --- a/demos/blockfactory/index.html +++ b/demos/blockfactory/index.html @@ -430,11 +430,6 @@ - diff --git a/demos/blockfactory_old/blocks.js b/demos/blockfactory_old/blocks.js index 050e53147..467eca2af 100644 --- a/demos/blockfactory_old/blocks.js +++ b/demos/blockfactory_old/blocks.js @@ -460,24 +460,6 @@ Blockly.Blocks['field_colour'] = { } }; -Blockly.Blocks['field_date'] = { - // Date input. - init: function() { - this.setColour(160); - this.appendDummyInput() - .appendField('date') - .appendField(new Blockly.FieldDate(), 'DATE') - .appendField(',') - .appendField(new Blockly.FieldTextInput('NAME'), 'FIELDNAME'); - this.setPreviousStatement(true, 'Field'); - this.setNextStatement(true, 'Field'); - this.setTooltip('Date input field.'); - }, - onchange: function() { - fieldNameCheck(this); - } -}; - Blockly.Blocks['field_variable'] = { // Dropdown for variables. init: function() { diff --git a/demos/blockfactory_old/factory.js b/demos/blockfactory_old/factory.js index 967d2a440..10c0adad1 100644 --- a/demos/blockfactory_old/factory.js +++ b/demos/blockfactory_old/factory.js @@ -335,12 +335,6 @@ function getFieldsJs_(block) { escapeString(block.getFieldValue('COLOUR')) + '), ' + escapeString(block.getFieldValue('FIELDNAME'))); break; - case 'field_date': - // Result: new Blockly.FieldDate('2015-02-04'), 'DATE' - fields.push('new Blockly.FieldDate(' + - escapeString(block.getFieldValue('DATE')) + '), ' + - escapeString(block.getFieldValue('FIELDNAME'))); - break; case 'field_variable': // Result: new Blockly.FieldVariable('item'), 'VAR' var varname = escapeString(block.getFieldValue('TEXT') || null); @@ -440,13 +434,6 @@ function getFieldsJson_(block) { colour: block.getFieldValue('COLOUR') }); break; - case 'field_date': - fields.push({ - type: block.type, - name: block.getFieldValue('FIELDNAME'), - date: block.getFieldValue('DATE') - }); - break; case 'field_variable': fields.push({ type: block.type, @@ -577,10 +564,6 @@ function updateGenerator(block) { // Subclass of Blockly.FieldTextInput, must test first. code.push(makeVar('angle', name) + " = block.getFieldValue('" + name + "');"); - } else if (Blockly.FieldDate && field instanceof Blockly.FieldDate) { - // Blockly.FieldDate may not be compiled into Blockly. - code.push(makeVar('date', name) + - " = block.getFieldValue('" + name + "');"); } else if (field instanceof Blockly.FieldColour) { code.push(makeVar('colour', name) + " = block.getFieldValue('" + name + "');"); diff --git a/demos/blockfactory_old/index.html b/demos/blockfactory_old/index.html index b03db9127..7cc448f81 100644 --- a/demos/blockfactory_old/index.html +++ b/demos/blockfactory_old/index.html @@ -196,11 +196,6 @@ - diff --git a/tests/blocks/test_blocks.js b/tests/blocks/test_blocks.js index 11247c6b4..5cf7ec685 100644 --- a/tests/blocks/test_blocks.js +++ b/tests/blocks/test_blocks.js @@ -693,23 +693,6 @@ Blockly.defineBlocksWithJsonArray([ // BEGIN JSON EXTRACT ], "style": "math_blocks", }, - { - "type": "test_fields_date", - "message0": "date: %1", - "args0": [ - { - "type": "field_date", - "name": "FIELDNAME", - "date": "2020-02-20", - "alt": - { - "type": "field_label", - "text": "NO DATE FIELD" - } - } - ], - "style": "math_blocks", - }, { "type": "test_fields_text_input", "message0": "text input %1", diff --git a/tests/mocha/field_date_test.js b/tests/mocha/field_date_test.js deleted file mode 100644 index 736339ee0..000000000 --- a/tests/mocha/field_date_test.js +++ /dev/null @@ -1,173 +0,0 @@ -/** - * @license - * Copyright 2019 Google LLC - * SPDX-License-Identifier: Apache-2.0 - */ - -/* If you want to run date tests add the date picker here: - * https://github.com/google/blockly/blob/master/core/blockly.js#L41 - * before unskipping. - */ -suite.skip('Date Fields', function() { - function assertValue(dateField, expectedValue) { - var actualValue = dateField.getValue(); - var actualText = dateField.getText(); - chai.assert.equal(actualValue, expectedValue); - chai.assert.equal(actualText, expectedValue); - } - function assertValueDefault(dateField) { - var today = new goog.date.Date().toIsoString(true); - assertValue(dateField, today); - } - suite('Constructor', function() { - test('Empty', function() { - var dateField = new Blockly.FieldDate(); - assertValueDefault(dateField); - }); - test('Undefined', function() { - var dateField = new Blockly.FieldDate(undefined); - assertValueDefault(dateField); - }); - test('Non-Parsable String', function() { - var dateField = new Blockly.FieldDate('bad'); - assertValueDefault(dateField); - }); - test('2020-02-20', function() { - var dateField = new Blockly.FieldDate('2020-02-20'); - assertValue(dateField, '2020-02-20'); - }); - test('Invalid Date - Month(2020-13-20)', function() { - var dateField = new Blockly.FieldDate('2020-13-20'); - assertValueDefault(dateField); - }); - test('Invalid Date - Day(2020-02-32)', function() { - var dateField = new Blockly.FieldDate('2020-02-32'); - assertValueDefault(dateField); - }); - }); - suite('fromJson', function() { - test('Empty', function() { - var dateField = Blockly.FieldDate.fromJson({}); - assertValueDefault(dateField); - }); - test('Undefined', function() { - var dateField = Blockly.FieldDate.fromJson({ date: undefined }); - assertValueDefault(dateField); - }); - test('Non-Parsable String', function() { - var dateField = Blockly.FieldDate.fromJson({ date: 'bad' }); - assertValueDefault(dateField); - }); - test('2020-02-20', function() { - var dateField = Blockly.FieldDate.fromJson({ date: '2020-02-20' }); - assertValue(dateField, '2020-02-20'); - }); - test('Invalid Date - Month(2020-13-20)', function() { - var dateField = Blockly.FieldDate.fromJson({ date: '2020-13-20' }); - assertValueDefault(dateField); - }); - test('Invalid Date - Day(2020-02-32)', function() { - var dateField = Blockly.FieldDate.fromJson({ date: '2020-02-32' }); - assertValueDefault(dateField); - }); - }); - suite('setValue', function() { - suite('Empty -> New Value', function() { - setup(function() { - this.dateField = new Blockly.FieldDate(); - }); - test('Null', function() { - this.dateField.setValue(null); - assertValueDefault(this.dateField); - }); - test('Undefined', function() { - this.dateField.setValue(undefined); - assertValueDefault(this.dateField); - }); - test('Non-Parsable String', function() { - this.dateField.setValue('bad'); - assertValueDefault(this.dateField); - }); - test('Invalid Date - Month(2020-13-20)', function() { - this.dateField.setValue('2020-13-20'); - assertValueDefault(this.dateField); - }); - test('Invalid Date - Day(2020-02-32)', function() { - this.dateField.setValue('2020-02-32'); - assertValueDefault(this.dateField); - }); - test('3030-03-30', function() { - this.dateField.setValue('3030-03-30'); - assertValue(this.dateField, '3030-03-30'); - }); - }); - suite('Value -> New Value', function() { - setup(function() { - this.dateField = new Blockly.FieldDate('2020-02-20'); - }); - test('Null', function() { - this.dateField.setValue(null); - assertValue(this.dateField, '2020-02-20'); - }); - test('Undefined', function() { - this.dateField.setValue(undefined); - assertValue(this.dateField, '2020-02-20'); - }); - test('Non-Parsable String', function() { - this.dateField.setValue('bad'); - assertValue(this.dateField, '2020-02-20'); - }); - test('Invalid Date - Month(2020-13-20)', function() { - this.dateField.setValue('2020-13-20'); - assertValue(this.dateField, '2020-02-20'); - }); - test('Invalid Date - Day(2020-02-32)', function() { - this.dateField.setValue('2020-02-32'); - assertValue(this.dateField, '2020-02-20'); - }); - test('3030-03-30', function() { - this.dateField.setValue('3030-03-30'); - assertValue(this.dateField, '3030-03-30'); - }); - }); - }); - suite('Validators', function() { - setup(function() { - this.dateField = new Blockly.FieldDate('2020-02-20'); - }); - teardown(function() { - this.dateField.setValidator(null); - }); - suite('Null Validator', function() { - setup(function() { - this.dateField.setValidator(function() { - return null; - }); - }); - test('New Value', function() { - this.dateField.setValue('3030-03-30'); - assertValue(this.dateField, '2020-02-20'); - }); - }); - suite('Force Day 20s Validator', function() { - setup(function() { - this.dateField.setValidator(function(newValue) { - return newValue.substr(0, 8) + '2' + newValue.substr(9, 1); - }); - }); - test('New Value', function() { - this.dateField.setValue('3030-03-30'); - assertValue(this.dateField, '3030-03-20'); - }); - }); - suite('Returns Undefined Validator', function() { - setup(function() { - this.dateField.setValidator(function() {}); - }); - test('New Value', function() { - this.dateField.setValue('3030-03-30'); - assertValue(this.dateField, '3030-03-30'); - }); - }); - }); -}); diff --git a/tests/mocha/index.html b/tests/mocha/index.html index 7e835769a..5cc469558 100644 --- a/tests/mocha/index.html +++ b/tests/mocha/index.html @@ -47,7 +47,6 @@ - diff --git a/tests/mocha/xml_test.js b/tests/mocha/xml_test.js index 8c367154b..0acab1b17 100644 --- a/tests/mocha/xml_test.js +++ b/tests/mocha/xml_test.js @@ -143,28 +143,6 @@ suite('XML', function() { var resultFieldDom = Blockly.Xml.blockToDom(block).childNodes[0]; assertNonVariableField(resultFieldDom, 'COLOUR', '#000099'); }); - /* If you want to run date tests add the date picker here: - * https://github.com/google/blockly/blob/master/core/blockly.js#L41 - * before unskipping. - */ - test.skip('Date', function() { - Blockly.defineBlocksWithJsonArray([{ - "type": "field_date_test_block", - "message0": "%1", - "args0": [ - { - "type": "field_date", - "name": "DATE", - "date": "2020-02-20" - } - ], - }]); - this.blockTypes_.push('field_date_test_block'); - var block = new Blockly.Block(this.workspace, - 'field_date_test_block'); - var resultFieldDom = Blockly.Xml.blockToDom(block).childNodes[0]; - assertNonVariableField(resultFieldDom, 'DATE', '2020-02-20'); - }); test('Dropdown', function() { Blockly.defineBlocksWithJsonArray([{ "type": "field_dropdown_test_block", diff --git a/tests/screenshot/test_cases/test_fields_date b/tests/screenshot/test_cases/test_fields_date deleted file mode 100644 index 26f0065b2..000000000 --- a/tests/screenshot/test_cases/test_fields_date +++ /dev/null @@ -1,3 +0,0 @@ - - - \ No newline at end of file diff --git a/typings/blockly.d.ts b/typings/blockly.d.ts index 425ab3ff4..67f70e610 100644 --- a/typings/blockly.d.ts +++ b/typings/blockly.d.ts @@ -4711,18 +4711,6 @@ declare module Blockly { } -declare module Blockly.FieldDate { - - /** - * Construct a FieldDate from a JSON arg object. - * @param {!Object} options A JSON object with options (date). - * @return {!Blockly.FieldDate} The new field instance. - * @package - * @nocollapse - */ - function fromJson(options: Object): Blockly.FieldDate; -} - declare module goog { /**