code_before
stringlengths
16
1.81M
edits
stringlengths
4
328k
next_edit
stringlengths
0
76.5k
code_after
stringlengths
3
49.9M
label_window
sequencelengths
4
1.81k
instruction
stringlengths
20
51.9k
html_url
stringlengths
74
116
file_name
stringlengths
3
311
"postcss-url": "5.1.2", "react": "15.5.1", "react-dom": "15.5.1", "react-test-renderer": "15.5.4", "run-sequence": "1.2.2", "sinon": "1.17.6", "sorted-object": "2.0.1", "source-map-loader": "0.1.5", "string-replace-loader": "1.0.5", "stylelint": "7.9.0",
</s> remove "source-map-loader": "0.1.5", "string-replace-loader": "1.0.5", "stylelint": "7.9.0", "stylelint-config-palantir": "2.0.2", "stylelint-scss": "1.4.3", "ts-loader": "0.9.5", </s> add "source-map-loader": "0.2.1", "string-replace-loader": "1.3.0", "stylelint": "8.0.0", "stylelint-config-palantir": "2.1.0", "stylelint-config-standard": "17.0.0", "stylelint-scss": "1.5.1", "ts-loader": "1.3.3", </s> remove "merge-stream": "1.0.0", "mocha": "3.1.2", "node-sass-package-importer": "3.0.0", "npm-run-all": "3.1.1", "phantomjs-prebuilt": "2.1.13", "postcss-copy-assets": "0.3.0", "postcss-import": "8.2.0", "postcss-url": "5.1.2", </s> add "merge-stream": "1.0.1", "mocha": "3.4.2", "node-sass-package-importer": "3.0.4", "npm-run-all": "4.0.2", "phantomjs-prebuilt": "2.1.14", "postcss-import": "10.0.0", "postcss-url": "7.1.1", </s> remove "sass-loader": "4.0.0", "style-loader": "0.13.1", "svgo": "0.7.1", "ts-loader": "0.8.2", </s> add "sass-loader": "4.1.1", "style-loader": "0.18.2", "svgo": "0.7.2", "ts-loader": "1.3.3", </s> remove "file-loader": "0.9.0", "http-server": "0.9.0", "imports-loader": "0.6.5", "json-loader": "0.5.4", "node-sass": "3.8.0", "npm-run-all": "2.3.0", "onchange": "3.0.2", </s> add "file-loader": "0.11.2", "http-server": "0.10.0", "imports-loader": "0.7.1", "json-loader": "0.5.7", "node-sass": "4.5.3", "npm-run-all": "4.0.2", "onchange": "3.2.1", </s> remove "karma-webpack": "1.8.0", </s> add "karma-webpack": "2.0.4",
"run-sequence": "2.0.0",
"postcss-url": "5.1.2", "react": "15.5.1", "react-dom": "15.5.1", "react-test-renderer": "15.5.4", "run-sequence": "2.0.0", "sinon": "1.17.6", "sorted-object": "2.0.1", "source-map-loader": "0.1.5", "string-replace-loader": "1.0.5", "stylelint": "7.9.0",
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
update development dependencies throughout (#1376) * update gulp dependencies * Update webpack loaders and misc tools * Update stylelint dependencies stylelint@8! postcss-url@7 supports copying assets so we can remove postcss-copy-assets entirely. (Note: resource paths are now dist/resources, not dist/assets) * Update karma dependencies, fix tests * upgrade site-landing dev deps
https://github.com/palantir/blueprint/commit/aac0f58792da928fe7fdff0bf543339f97a81ef3
package.json
"react-test-renderer": "15.5.4", "run-sequence": "1.2.2", "sinon": "1.17.6", "sorted-object": "2.0.1", "source-map-loader": "0.1.5", "string-replace-loader": "1.0.5", "stylelint": "7.9.0", "stylelint-config-palantir": "2.0.2", "stylelint-scss": "1.4.3", "ts-loader": "0.9.5", "ts-quick-docs": "0.5.1", "tslint": "4.5.1", "tslint-react": "2.4.0", "typescript": "2.2.1", "vinyl-source-stream": "1.1.0",
</s> remove "run-sequence": "1.2.2", </s> add "run-sequence": "2.0.0", </s> remove "merge-stream": "1.0.0", "mocha": "3.1.2", "node-sass-package-importer": "3.0.0", "npm-run-all": "3.1.1", "phantomjs-prebuilt": "2.1.13", "postcss-copy-assets": "0.3.0", "postcss-import": "8.2.0", "postcss-url": "5.1.2", </s> add "merge-stream": "1.0.1", "mocha": "3.4.2", "node-sass-package-importer": "3.0.4", "npm-run-all": "4.0.2", "phantomjs-prebuilt": "2.1.14", "postcss-import": "10.0.0", "postcss-url": "7.1.1", </s> remove "sass-loader": "4.0.0", "style-loader": "0.13.1", "svgo": "0.7.1", "ts-loader": "0.8.2", </s> add "sass-loader": "4.1.1", "style-loader": "0.18.2", "svgo": "0.7.2", "ts-loader": "1.3.3", </s> remove "file-loader": "0.9.0", "http-server": "0.9.0", "imports-loader": "0.6.5", "json-loader": "0.5.4", "node-sass": "3.8.0", "npm-run-all": "2.3.0", "onchange": "3.0.2", </s> add "file-loader": "0.11.2", "http-server": "0.10.0", "imports-loader": "0.7.1", "json-loader": "0.5.7", "node-sass": "4.5.3", "npm-run-all": "4.0.2", "onchange": "3.2.1", </s> remove "karma-webpack": "1.8.0", </s> add "karma-webpack": "2.0.4",
"source-map-loader": "0.2.1", "string-replace-loader": "1.3.0", "stylelint": "8.0.0", "stylelint-config-palantir": "2.1.0", "stylelint-config-standard": "17.0.0", "stylelint-scss": "1.5.1", "ts-loader": "1.3.3",
"react-test-renderer": "15.5.4", "run-sequence": "1.2.2", "sinon": "1.17.6", "sorted-object": "2.0.1", "source-map-loader": "0.2.1", "string-replace-loader": "1.3.0", "stylelint": "8.0.0", "stylelint-config-palantir": "2.1.0", "stylelint-config-standard": "17.0.0", "stylelint-scss": "1.5.1", "ts-loader": "1.3.3", "source-map-loader": "0.2.1", "string-replace-loader": "1.3.0", "stylelint": "8.0.0", "stylelint-config-palantir": "2.1.0", "stylelint-config-standard": "17.0.0", "stylelint-scss": "1.5.1", "ts-loader": "1.3.3", "source-map-loader": "0.2.1", "string-replace-loader": "1.3.0", "stylelint": "8.0.0", "stylelint-config-palantir": "2.1.0", "stylelint-config-standard": "17.0.0", "stylelint-scss": "1.5.1", "ts-loader": "1.3.3", "source-map-loader": "0.2.1", "string-replace-loader": "1.3.0", "stylelint": "8.0.0", "stylelint-config-palantir": "2.1.0", "stylelint-config-standard": "17.0.0", "stylelint-scss": "1.5.1", "ts-loader": "1.3.3", "source-map-loader": "0.2.1", "string-replace-loader": "1.3.0", "stylelint": "8.0.0", "stylelint-config-palantir": "2.1.0", "stylelint-config-standard": "17.0.0", "stylelint-scss": "1.5.1", "ts-loader": "1.3.3", "source-map-loader": "0.2.1", "string-replace-loader": "1.3.0", "stylelint": "8.0.0", "stylelint-config-palantir": "2.1.0", "stylelint-config-standard": "17.0.0", "stylelint-scss": "1.5.1", "ts-loader": "1.3.3", "ts-quick-docs": "0.5.1", "tslint": "4.5.1", "tslint-react": "2.4.0", "typescript": "2.2.1", "vinyl-source-stream": "1.1.0",
[ "keep", "keep", "keep", "keep", "replace", "replace", "replace", "replace", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
update development dependencies throughout (#1376) * update gulp dependencies * Update webpack loaders and misc tools * Update stylelint dependencies stylelint@8! postcss-url@7 supports copying assets so we can remove postcss-copy-assets entirely. (Note: resource paths are now dist/resources, not dist/assets) * Update karma dependencies, fix tests * upgrade site-landing dev deps
https://github.com/palantir/blueprint/commit/aac0f58792da928fe7fdff0bf543339f97a81ef3
package.json
const { getSelectedDays } = wrap( <DatePicker defaultValue={new Date(2010, Months.FEBRUARY, 2)} value={value} />, ); assert.lengthOf(getSelectedDays(), 1); assert.equal(getSelectedDays().at(0).text(), value.getDate()); }); it("selection does not update automatically", () => { const { getDay, getSelectedDays } = wrap(<DatePicker value={null} />); assert.lengthOf(getSelectedDays(), 0);
</s> remove assert.equal(selectedDays.at(0).text(), today.getDate()); </s> add assert.equal(selectedDays.at(0).text(), today.getDate().toString()); </s> remove assert.equal(selectedDayElements.at(0).text(), maxDate.getDate()); </s> add assert.equal(selectedDayElements.at(0).text(), maxDate.getDate().toString()); </s> remove assert.equal(selectedDays[0].textContent, value[0].getDate()); </s> add assert.equal(selectedDays[0].textContent, value[0].getDate().toString()); </s> remove assert.equal(selectedDays[0].textContent, today.getDate()); </s> add assert.equal(selectedDays[0].textContent, today.getDate().toString()); </s> remove assert.equal(selectedDayElements.at(0).text(), minDate.getDate()); </s> add assert.equal(selectedDayElements.at(0).text(), minDate.getDate().toString());
assert.equal(getSelectedDays().at(0).text(), value.getDate().toString());
const { getSelectedDays } = wrap( <DatePicker defaultValue={new Date(2010, Months.FEBRUARY, 2)} value={value} />, ); assert.lengthOf(getSelectedDays(), 1); assert.equal(getSelectedDays().at(0).text(), value.getDate().toString()); }); it("selection does not update automatically", () => { const { getDay, getSelectedDays } = wrap(<DatePicker value={null} />); assert.lengthOf(getSelectedDays(), 0);
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
update development dependencies throughout (#1376) * update gulp dependencies * Update webpack loaders and misc tools * Update stylelint dependencies stylelint@8! postcss-url@7 supports copying assets so we can remove postcss-copy-assets entirely. (Note: resource paths are now dist/resources, not dist/assets) * Update karma dependencies, fix tests * upgrade site-landing dev deps
https://github.com/palantir/blueprint/commit/aac0f58792da928fe7fdff0bf543339f97a81ef3
packages/datetime/test/datePickerTests.tsx
it("defaultValue initially selects a day", () => { const today = new Date(); const selectedDays = wrap(<DatePicker defaultValue={today} />).getSelectedDays(); assert.lengthOf(selectedDays, 1); assert.equal(selectedDays.at(0).text(), today.getDate()); }); it("onChange fired when a day is clicked", () => { const onChange = sinon.spy(); const { getDay } = wrap(<DatePicker onChange={onChange} />);
</s> remove assert.equal(selectedDays[0].textContent, today.getDate()); </s> add assert.equal(selectedDays[0].textContent, today.getDate().toString()); </s> remove assert.equal(selectedDays[0].textContent, value[0].getDate()); </s> add assert.equal(selectedDays[0].textContent, value[0].getDate().toString()); </s> remove assert.equal(getSelectedDays().at(0).text(), value.getDate()); </s> add assert.equal(getSelectedDays().at(0).text(), value.getDate().toString()); </s> remove assert.equal(selectedDayElements.at(0).text(), maxDate.getDate()); </s> add assert.equal(selectedDayElements.at(0).text(), maxDate.getDate().toString()); </s> remove assert.equal(monthSelects[0].getAttribute("value"), Months.JANUARY); assert.equal(monthSelects[monthSelects.length - 1].getAttribute("value"), Months.NOVEMBER); </s> add const assertValueAt = (index: number, month: Months) => assert.equal(monthSelects[index].getAttribute("value"), month.toString()); assertValueAt(0, Months.JANUARY); assertValueAt(monthSelects.length - 1, Months.NOVEMBER);
assert.equal(selectedDays.at(0).text(), today.getDate().toString());
it("defaultValue initially selects a day", () => { const today = new Date(); const selectedDays = wrap(<DatePicker defaultValue={today} />).getSelectedDays(); assert.lengthOf(selectedDays, 1); assert.equal(selectedDays.at(0).text(), today.getDate().toString()); }); it("onChange fired when a day is clicked", () => { const onChange = sinon.spy(); const { getDay } = wrap(<DatePicker onChange={onChange} />);
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
update development dependencies throughout (#1376) * update gulp dependencies * Update webpack loaders and misc tools * Update stylelint dependencies stylelint@8! postcss-url@7 supports copying assets so we can remove postcss-copy-assets entirely. (Note: resource paths are now dist/resources, not dist/assets) * Update karma dependencies, fix tests * upgrade site-landing dev deps
https://github.com/palantir/blueprint/commit/aac0f58792da928fe7fdff0bf543339f97a81ef3
packages/datetime/test/datePickerTests.tsx
getDay(1).simulate("click"); months.simulate("change", { target: { value: Months.MARCH } }); let selectedDayElements = getSelectedDays(); assert.lengthOf(selectedDayElements, 1); assert.equal(selectedDayElements.at(0).text(), minDate.getDate()); getDay(25).simulate("click"); months.simulate("change", { target: { value: Months.NOVEMBER } }); selectedDayElements = getSelectedDays(); assert.lengthOf(selectedDayElements, 1);
</s> remove assert.equal(selectedDayElements.at(0).text(), maxDate.getDate()); </s> add assert.equal(selectedDayElements.at(0).text(), maxDate.getDate().toString()); </s> remove assert.equal(selectedDays[0].textContent, value[0].getDate()); </s> add assert.equal(selectedDays[0].textContent, value[0].getDate().toString()); </s> remove assert.equal(getSelectedDays().at(0).text(), value.getDate()); </s> add assert.equal(getSelectedDays().at(0).text(), value.getDate().toString()); </s> remove assert.equal(selectedDays.at(0).text(), today.getDate()); </s> add assert.equal(selectedDays.at(0).text(), today.getDate().toString()); </s> remove assert.equal(selectedDays[0].textContent, today.getDate()); </s> add assert.equal(selectedDays[0].textContent, today.getDate().toString());
assert.equal(selectedDayElements.at(0).text(), minDate.getDate().toString());
getDay(1).simulate("click"); months.simulate("change", { target: { value: Months.MARCH } }); let selectedDayElements = getSelectedDays(); assert.lengthOf(selectedDayElements, 1); assert.equal(selectedDayElements.at(0).text(), minDate.getDate().toString()); getDay(25).simulate("click"); months.simulate("change", { target: { value: Months.NOVEMBER } }); selectedDayElements = getSelectedDays(); assert.lengthOf(selectedDayElements, 1);
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
update development dependencies throughout (#1376) * update gulp dependencies * Update webpack loaders and misc tools * Update stylelint dependencies stylelint@8! postcss-url@7 supports copying assets so we can remove postcss-copy-assets entirely. (Note: resource paths are now dist/resources, not dist/assets) * Update karma dependencies, fix tests * upgrade site-landing dev deps
https://github.com/palantir/blueprint/commit/aac0f58792da928fe7fdff0bf543339f97a81ef3
packages/datetime/test/datePickerTests.tsx
getDay(25).simulate("click"); months.simulate("change", { target: { value: Months.NOVEMBER } }); selectedDayElements = getSelectedDays(); assert.lengthOf(selectedDayElements, 1); assert.equal(selectedDayElements.at(0).text(), maxDate.getDate()); }); it("can change displayed date with the dropdowns in the caption", () => { const { months, root, years } = wrap(<DatePicker initialMonth={new Date(2015, Months.MARCH, 2)} />); assert.equal(root.state("displayMonth"), Months.MARCH);
</s> remove assert.equal(selectedDayElements.at(0).text(), minDate.getDate()); </s> add assert.equal(selectedDayElements.at(0).text(), minDate.getDate().toString()); </s> remove assert.equal(getSelectedDays().at(0).text(), value.getDate()); </s> add assert.equal(getSelectedDays().at(0).text(), value.getDate().toString()); </s> remove assert.equal(selectedDays.at(0).text(), today.getDate()); </s> add assert.equal(selectedDays.at(0).text(), today.getDate().toString()); </s> remove assert.equal(selectedDays[0].textContent, value[0].getDate()); </s> add assert.equal(selectedDays[0].textContent, value[0].getDate().toString()); </s> remove assert.equal(monthSelects[0].getAttribute("value"), Months.JANUARY); assert.equal(monthSelects[monthSelects.length - 1].getAttribute("value"), Months.NOVEMBER); </s> add const assertValueAt = (index: number, month: Months) => assert.equal(monthSelects[index].getAttribute("value"), month.toString()); assertValueAt(0, Months.JANUARY); assertValueAt(monthSelects.length - 1, Months.NOVEMBER);
assert.equal(selectedDayElements.at(0).text(), maxDate.getDate().toString());
getDay(25).simulate("click"); months.simulate("change", { target: { value: Months.NOVEMBER } }); selectedDayElements = getSelectedDays(); assert.lengthOf(selectedDayElements, 1); assert.equal(selectedDayElements.at(0).text(), maxDate.getDate().toString()); }); it("can change displayed date with the dropdowns in the caption", () => { const { months, root, years } = wrap(<DatePicker initialMonth={new Date(2015, Months.MARCH, 2)} />); assert.equal(root.state("displayMonth"), Months.MARCH);
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
update development dependencies throughout (#1376) * update gulp dependencies * Update webpack loaders and misc tools * Update stylelint dependencies stylelint@8! postcss-url@7 supports copying assets so we can remove postcss-copy-assets entirely. (Note: resource paths are now dist/resources, not dist/assets) * Update karma dependencies, fix tests * upgrade site-landing dev deps
https://github.com/palantir/blueprint/commit/aac0f58792da928fe7fdff0bf543339f97a81ef3
packages/datetime/test/datePickerTests.tsx
const maxDate = new Date(2015, Months.DECEMBER, 15); renderDateRangePicker({ contiguousCalendarMonths, maxDate, minDate }); const monthSelects = getMonthSelect().children; assert.equal(monthSelects[0].getAttribute("value"), Months.JANUARY); assert.equal(monthSelects[monthSelects.length - 1].getAttribute("value"), Months.NOVEMBER); }); it("right calendar is bound between (minDate + 1 month) and maxDate", () => { const contiguousCalendarMonths = false; const minDate = new Date(2015, Months.JANUARY, 1);
</s> remove assert.equal(monthSelects[0].getAttribute("value"), Months.FEBRUARY); assert.equal(monthSelects[monthSelects.length - 1].getAttribute("value"), Months.DECEMBER); </s> add const assertValueAt = (index: number, month: Months) => assert.equal(monthSelects[index].getAttribute("value"), month.toString()); assertValueAt(0, Months.FEBRUARY); assertValueAt(monthSelects.length - 1, Months.DECEMBER); </s> remove assert.equal(selectedDays[0].textContent, today.getDate()); </s> add assert.equal(selectedDays[0].textContent, today.getDate().toString()); </s> remove assert.equal(selectedDays[0].textContent, value[0].getDate()); </s> add assert.equal(selectedDays[0].textContent, value[0].getDate().toString()); </s> remove assert.equal(selectedDays.at(0).text(), today.getDate()); </s> add assert.equal(selectedDays.at(0).text(), today.getDate().toString()); </s> remove assert.equal(selectedDayElements.at(0).text(), maxDate.getDate()); </s> add assert.equal(selectedDayElements.at(0).text(), maxDate.getDate().toString());
const assertValueAt = (index: number, month: Months) => assert.equal(monthSelects[index].getAttribute("value"), month.toString()); assertValueAt(0, Months.JANUARY); assertValueAt(monthSelects.length - 1, Months.NOVEMBER);
const maxDate = new Date(2015, Months.DECEMBER, 15); renderDateRangePicker({ contiguousCalendarMonths, maxDate, minDate }); const monthSelects = getMonthSelect().children; const assertValueAt = (index: number, month: Months) => assert.equal(monthSelects[index].getAttribute("value"), month.toString()); assertValueAt(0, Months.JANUARY); assertValueAt(monthSelects.length - 1, Months.NOVEMBER); const assertValueAt = (index: number, month: Months) => assert.equal(monthSelects[index].getAttribute("value"), month.toString()); assertValueAt(0, Months.JANUARY); assertValueAt(monthSelects.length - 1, Months.NOVEMBER); }); it("right calendar is bound between (minDate + 1 month) and maxDate", () => { const contiguousCalendarMonths = false; const minDate = new Date(2015, Months.JANUARY, 1);
[ "keep", "keep", "keep", "keep", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
update development dependencies throughout (#1376) * update gulp dependencies * Update webpack loaders and misc tools * Update stylelint dependencies stylelint@8! postcss-url@7 supports copying assets so we can remove postcss-copy-assets entirely. (Note: resource paths are now dist/resources, not dist/assets) * Update karma dependencies, fix tests * upgrade site-landing dev deps
https://github.com/palantir/blueprint/commit/aac0f58792da928fe7fdff0bf543339f97a81ef3
packages/datetime/test/dateRangePickerTests.tsx
const maxDate = new Date(2015, Months.DECEMBER, 15); renderDateRangePicker({ contiguousCalendarMonths, maxDate, minDate }); const monthSelects = getMonthSelect(false).children; assert.equal(monthSelects[0].getAttribute("value"), Months.FEBRUARY); assert.equal(monthSelects[monthSelects.length - 1].getAttribute("value"), Months.DECEMBER); }); it("left calendar can be altered independently of right calendar", () => { const contiguousCalendarMonths = false; const initialMonth = new Date(2015, Months.MAY, 5);
</s> remove assert.equal(monthSelects[0].getAttribute("value"), Months.JANUARY); assert.equal(monthSelects[monthSelects.length - 1].getAttribute("value"), Months.NOVEMBER); </s> add const assertValueAt = (index: number, month: Months) => assert.equal(monthSelects[index].getAttribute("value"), month.toString()); assertValueAt(0, Months.JANUARY); assertValueAt(monthSelects.length - 1, Months.NOVEMBER); </s> remove assert.equal(selectedDays[0].textContent, today.getDate()); </s> add assert.equal(selectedDays[0].textContent, today.getDate().toString()); </s> remove assert.equal(selectedDays.at(0).text(), today.getDate()); </s> add assert.equal(selectedDays.at(0).text(), today.getDate().toString()); </s> remove assert.equal(selectedDays[0].textContent, value[0].getDate()); </s> add assert.equal(selectedDays[0].textContent, value[0].getDate().toString()); </s> remove assert.equal(selectedDayElements.at(0).text(), maxDate.getDate()); </s> add assert.equal(selectedDayElements.at(0).text(), maxDate.getDate().toString());
const assertValueAt = (index: number, month: Months) => assert.equal(monthSelects[index].getAttribute("value"), month.toString()); assertValueAt(0, Months.FEBRUARY); assertValueAt(monthSelects.length - 1, Months.DECEMBER);
const maxDate = new Date(2015, Months.DECEMBER, 15); renderDateRangePicker({ contiguousCalendarMonths, maxDate, minDate }); const monthSelects = getMonthSelect(false).children; const assertValueAt = (index: number, month: Months) => assert.equal(monthSelects[index].getAttribute("value"), month.toString()); assertValueAt(0, Months.FEBRUARY); assertValueAt(monthSelects.length - 1, Months.DECEMBER); const assertValueAt = (index: number, month: Months) => assert.equal(monthSelects[index].getAttribute("value"), month.toString()); assertValueAt(0, Months.FEBRUARY); assertValueAt(monthSelects.length - 1, Months.DECEMBER); }); it("left calendar can be altered independently of right calendar", () => { const contiguousCalendarMonths = false; const initialMonth = new Date(2015, Months.MAY, 5);
[ "keep", "keep", "keep", "keep", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
update development dependencies throughout (#1376) * update gulp dependencies * Update webpack loaders and misc tools * Update stylelint dependencies stylelint@8! postcss-url@7 supports copying assets so we can remove postcss-copy-assets entirely. (Note: resource paths are now dist/resources, not dist/assets) * Update karma dependencies, fix tests * upgrade site-landing dev deps
https://github.com/palantir/blueprint/commit/aac0f58792da928fe7fdff0bf543339f97a81ef3
packages/datetime/test/dateRangePickerTests.tsx
const value = [new Date(2010, Months.JANUARY, 1), null] as DateRange; renderDateRangePicker({ defaultValue, value }); const selectedDays = getSelectedDayElements(); assert.lengthOf(selectedDays, 1); assert.equal(selectedDays[0].textContent, value[0].getDate()); }); it("onChange fired when a day is clicked", () => { renderDateRangePicker({ value: [null, null] }); assert.isTrue(onDateRangePickerChangeSpy.notCalled);
</s> remove assert.equal(selectedDays[0].textContent, today.getDate()); </s> add assert.equal(selectedDays[0].textContent, today.getDate().toString()); </s> remove assert.equal(selectedDays.at(0).text(), today.getDate()); </s> add assert.equal(selectedDays.at(0).text(), today.getDate().toString()); </s> remove assert.equal(monthSelects[0].getAttribute("value"), Months.JANUARY); assert.equal(monthSelects[monthSelects.length - 1].getAttribute("value"), Months.NOVEMBER); </s> add const assertValueAt = (index: number, month: Months) => assert.equal(monthSelects[index].getAttribute("value"), month.toString()); assertValueAt(0, Months.JANUARY); assertValueAt(monthSelects.length - 1, Months.NOVEMBER); </s> remove assert.equal(monthSelects[0].getAttribute("value"), Months.FEBRUARY); assert.equal(monthSelects[monthSelects.length - 1].getAttribute("value"), Months.DECEMBER); </s> add const assertValueAt = (index: number, month: Months) => assert.equal(monthSelects[index].getAttribute("value"), month.toString()); assertValueAt(0, Months.FEBRUARY); assertValueAt(monthSelects.length - 1, Months.DECEMBER); </s> remove assert.equal(getSelectedDays().at(0).text(), value.getDate()); </s> add assert.equal(getSelectedDays().at(0).text(), value.getDate().toString());
assert.equal(selectedDays[0].textContent, value[0].getDate().toString());
const value = [new Date(2010, Months.JANUARY, 1), null] as DateRange; renderDateRangePicker({ defaultValue, value }); const selectedDays = getSelectedDayElements(); assert.lengthOf(selectedDays, 1); assert.equal(selectedDays[0].textContent, value[0].getDate().toString()); }); it("onChange fired when a day is clicked", () => { renderDateRangePicker({ value: [null, null] }); assert.isTrue(onDateRangePickerChangeSpy.notCalled);
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
update development dependencies throughout (#1376) * update gulp dependencies * Update webpack loaders and misc tools * Update stylelint dependencies stylelint@8! postcss-url@7 supports copying assets so we can remove postcss-copy-assets entirely. (Note: resource paths are now dist/resources, not dist/assets) * Update karma dependencies, fix tests * upgrade site-landing dev deps
https://github.com/palantir/blueprint/commit/aac0f58792da928fe7fdff0bf543339f97a81ef3
packages/datetime/test/dateRangePickerTests.tsx
const today = new Date(); renderDateRangePicker({ defaultValue: [today, null] }); const selectedDays = getSelectedDayElements(); assert.lengthOf(selectedDays, 1); assert.equal(selectedDays[0].textContent, today.getDate()); }); it("onChange fired when a day is clicked", () => { renderDateRangePicker(); assert.isTrue(onDateRangePickerChangeSpy.notCalled);
</s> remove assert.equal(selectedDays[0].textContent, value[0].getDate()); </s> add assert.equal(selectedDays[0].textContent, value[0].getDate().toString()); </s> remove assert.equal(selectedDays.at(0).text(), today.getDate()); </s> add assert.equal(selectedDays.at(0).text(), today.getDate().toString()); </s> remove assert.equal(monthSelects[0].getAttribute("value"), Months.JANUARY); assert.equal(monthSelects[monthSelects.length - 1].getAttribute("value"), Months.NOVEMBER); </s> add const assertValueAt = (index: number, month: Months) => assert.equal(monthSelects[index].getAttribute("value"), month.toString()); assertValueAt(0, Months.JANUARY); assertValueAt(monthSelects.length - 1, Months.NOVEMBER); </s> remove assert.equal(monthSelects[0].getAttribute("value"), Months.FEBRUARY); assert.equal(monthSelects[monthSelects.length - 1].getAttribute("value"), Months.DECEMBER); </s> add const assertValueAt = (index: number, month: Months) => assert.equal(monthSelects[index].getAttribute("value"), month.toString()); assertValueAt(0, Months.FEBRUARY); assertValueAt(monthSelects.length - 1, Months.DECEMBER); </s> remove assert.equal(getSelectedDays().at(0).text(), value.getDate()); </s> add assert.equal(getSelectedDays().at(0).text(), value.getDate().toString());
assert.equal(selectedDays[0].textContent, today.getDate().toString());
const today = new Date(); renderDateRangePicker({ defaultValue: [today, null] }); const selectedDays = getSelectedDayElements(); assert.lengthOf(selectedDays, 1); assert.equal(selectedDays[0].textContent, today.getDate().toString()); }); it("onChange fired when a day is clicked", () => { renderDateRangePicker(); assert.isTrue(onDateRangePickerChangeSpy.notCalled);
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
update development dependencies throughout (#1376) * update gulp dependencies * Update webpack loaders and misc tools * Update stylelint dependencies stylelint@8! postcss-url@7 supports copying assets so we can remove postcss-copy-assets entirely. (Note: resource paths are now dist/resources, not dist/assets) * Update karma dependencies, fix tests * upgrade site-landing dev deps
https://github.com/palantir/blueprint/commit/aac0f58792da928fe7fdff0bf543339f97a81ef3
packages/datetime/test/dateRangePickerTests.tsx
// of the license at https://github.com/palantir/blueprint/blob/master/LICENSE // and https://github.com/palantir/blueprint/blob/master/PATENTS @import "~@blueprintjs/core/src/common/variables"; @import "~@blueprintjs/core/src/components/button/common"; $svg-icon-size: 36px; $hover-transition: $pt-transition-duration $pt-transition-ease;
</s> remove // rebase all urls due to inlining postcssUrl({ url: "rebase" }), // copy assets to dist folder, respecting rebase postcssCopyAssets({ pathTransform: (newPath, origPath) => { return path.resolve( blueprint.destPath(project), "assets", path.basename(origPath) ); }, </s> add // copy all url() assets into dist/resources/... postcssUrl({ assetsPath: "./assets", basePath: [ // search current package and core resources "../resources", "../../core/resources", // if new resources are added to packages, they'll need to be listed here ], url: "copy", </s> remove const postcssOptions = { map: { inline: false }, to : blueprint.destPath(project, "dist.css"), }; </s> add </s> remove .pipe(plugins.postcss(postcssPlugins, postcssOptions)) </s> add .pipe(plugins.postcss(postcssPlugins, { to : blueprint.destPath(project, "dist.css"), })) </s> remove assert.equal(selectedDayElements.at(0).text(), maxDate.getDate()); </s> add assert.equal(selectedDayElements.at(0).text(), maxDate.getDate().toString()); </s> remove assert.equal(monthSelects[0].getAttribute("value"), Months.FEBRUARY); assert.equal(monthSelects[monthSelects.length - 1].getAttribute("value"), Months.DECEMBER); </s> add const assertValueAt = (index: number, month: Months) => assert.equal(monthSelects[index].getAttribute("value"), month.toString()); assertValueAt(0, Months.FEBRUARY); assertValueAt(monthSelects.length - 1, Months.DECEMBER);
// of the license at https://github.com/palantir/blueprint/blob/master/LICENSE // and https://github.com/palantir/blueprint/blob/master/PATENTS @import "~@blueprintjs/core/src/common/variables"; $svg-icon-size: 36px; $hover-transition: $pt-transition-duration $pt-transition-ease;
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
update development dependencies throughout (#1376) * update gulp dependencies * Update webpack loaders and misc tools * Update stylelint dependencies stylelint@8! postcss-url@7 supports copying assets so we can remove postcss-copy-assets entirely. (Note: resource paths are now dist/resources, not dist/assets) * Update karma dependencies, fix tests * upgrade site-landing dev deps
https://github.com/palantir/blueprint/commit/aac0f58792da928fe7fdff0bf543339f97a81ef3
packages/site-docs/src/styles/_icons.scss
"watch": "onchange 'src/**' -- npm-run-all build:copy build:webpack" }, "devDependencies": { "@blueprintjs/core": "^1.14.0", "autoprefixer": "6.5.1", "classnames": "2.2.5", "css-loader": "0.23.1", "extract-text-webpack-plugin": "1.0.1", "file-loader": "0.9.0", "http-server": "0.9.0",
</s> remove "css-loader": "0.23.1", </s> add "css-loader": "0.28.4", </s> remove "file-loader": "0.9.0", "http-server": "0.9.0", "imports-loader": "0.6.5", "json-loader": "0.5.4", "node-sass": "3.8.0", "npm-run-all": "2.3.0", "onchange": "3.0.2", </s> add "file-loader": "0.11.2", "http-server": "0.10.0", "imports-loader": "0.7.1", "json-loader": "0.5.7", "node-sass": "4.5.3", "npm-run-all": "4.0.2", "onchange": "3.2.1", </s> remove "http-server": "0.9.0", </s> add "http-server": "0.10.0", </s> remove "karma": "1.3.0", </s> add "karma": "1.7.0", </s> remove "resources/favicon.png": { to: ["assets/"], base: "resources/" }, </s> add "resources/favicon.png": { to: ["resources/"], base: "resources/" },
"autoprefixer": "7.1.2",
"watch": "onchange 'src/**' -- npm-run-all build:copy build:webpack" }, "devDependencies": { "@blueprintjs/core": "^1.14.0", "autoprefixer": "7.1.2", "classnames": "2.2.5", "css-loader": "0.23.1", "extract-text-webpack-plugin": "1.0.1", "file-loader": "0.9.0", "http-server": "0.9.0",
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
update development dependencies throughout (#1376) * update gulp dependencies * Update webpack loaders and misc tools * Update stylelint dependencies stylelint@8! postcss-url@7 supports copying assets so we can remove postcss-copy-assets entirely. (Note: resource paths are now dist/resources, not dist/assets) * Update karma dependencies, fix tests * upgrade site-landing dev deps
https://github.com/palantir/blueprint/commit/aac0f58792da928fe7fdff0bf543339f97a81ef3
packages/site-landing/package.json
"devDependencies": { "@blueprintjs/core": "^1.14.0", "autoprefixer": "6.5.1", "classnames": "2.2.5", "css-loader": "0.23.1", "extract-text-webpack-plugin": "1.0.1", "file-loader": "0.9.0", "http-server": "0.9.0", "imports-loader": "0.6.5", "json-loader": "0.5.4",
</s> remove "autoprefixer": "6.5.1", </s> add "autoprefixer": "7.1.2", </s> remove "file-loader": "0.9.0", "http-server": "0.9.0", "imports-loader": "0.6.5", "json-loader": "0.5.4", "node-sass": "3.8.0", "npm-run-all": "2.3.0", "onchange": "3.0.2", </s> add "file-loader": "0.11.2", "http-server": "0.10.0", "imports-loader": "0.7.1", "json-loader": "0.5.7", "node-sass": "4.5.3", "npm-run-all": "4.0.2", "onchange": "3.2.1", </s> remove "http-server": "0.9.0", </s> add "http-server": "0.10.0", </s> remove "karma": "1.3.0", </s> add "karma": "1.7.0", </s> remove "gulp-stylelint": "3.9.0", "gulp-tslint": "7.0.1", "gulp-typescript": "3.1.4", "gulp-util": "3.0.7", </s> add "gulp-stylelint": "4.0.0", "gulp-tslint": "8.1.1", "gulp-typescript": "3.2.1", "gulp-util": "3.0.8",
"css-loader": "0.28.4",
"devDependencies": { "@blueprintjs/core": "^1.14.0", "autoprefixer": "6.5.1", "classnames": "2.2.5", "css-loader": "0.28.4", "extract-text-webpack-plugin": "1.0.1", "file-loader": "0.9.0", "http-server": "0.9.0", "imports-loader": "0.6.5", "json-loader": "0.5.4",
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
update development dependencies throughout (#1376) * update gulp dependencies * Update webpack loaders and misc tools * Update stylelint dependencies stylelint@8! postcss-url@7 supports copying assets so we can remove postcss-copy-assets entirely. (Note: resource paths are now dist/resources, not dist/assets) * Update karma dependencies, fix tests * upgrade site-landing dev deps
https://github.com/palantir/blueprint/commit/aac0f58792da928fe7fdff0bf543339f97a81ef3
packages/site-landing/package.json
"autoprefixer": "6.5.1", "classnames": "2.2.5", "css-loader": "0.23.1", "extract-text-webpack-plugin": "1.0.1", "file-loader": "0.9.0", "http-server": "0.9.0", "imports-loader": "0.6.5", "json-loader": "0.5.4", "node-sass": "3.8.0", "npm-run-all": "2.3.0", "onchange": "3.0.2", "postcss-loader": "1.1.0", "raw-loader": "0.5.1", "react": "15.5.1", "react-addons-css-transition-group": "15.5.1", "react-dom": "15.5.1",
</s> remove "css-loader": "0.23.1", </s> add "css-loader": "0.28.4", </s> remove "autoprefixer": "6.5.1", </s> add "autoprefixer": "7.1.2", </s> remove "sass-loader": "4.0.0", "style-loader": "0.13.1", "svgo": "0.7.1", "ts-loader": "0.8.2", </s> add "sass-loader": "4.1.1", "style-loader": "0.18.2", "svgo": "0.7.2", "ts-loader": "1.3.3", </s> remove "merge-stream": "1.0.0", "mocha": "3.1.2", "node-sass-package-importer": "3.0.0", "npm-run-all": "3.1.1", "phantomjs-prebuilt": "2.1.13", "postcss-copy-assets": "0.3.0", "postcss-import": "8.2.0", "postcss-url": "5.1.2", </s> add "merge-stream": "1.0.1", "mocha": "3.4.2", "node-sass-package-importer": "3.0.4", "npm-run-all": "4.0.2", "phantomjs-prebuilt": "2.1.14", "postcss-import": "10.0.0", "postcss-url": "7.1.1", </s> remove "run-sequence": "1.2.2", </s> add "run-sequence": "2.0.0",
"file-loader": "0.11.2", "http-server": "0.10.0", "imports-loader": "0.7.1", "json-loader": "0.5.7", "node-sass": "4.5.3", "npm-run-all": "4.0.2", "onchange": "3.2.1",
"autoprefixer": "6.5.1", "classnames": "2.2.5", "css-loader": "0.23.1", "extract-text-webpack-plugin": "1.0.1", "file-loader": "0.11.2", "http-server": "0.10.0", "imports-loader": "0.7.1", "json-loader": "0.5.7", "node-sass": "4.5.3", "npm-run-all": "4.0.2", "onchange": "3.2.1", "file-loader": "0.11.2", "http-server": "0.10.0", "imports-loader": "0.7.1", "json-loader": "0.5.7", "node-sass": "4.5.3", "npm-run-all": "4.0.2", "onchange": "3.2.1", "file-loader": "0.11.2", "http-server": "0.10.0", "imports-loader": "0.7.1", "json-loader": "0.5.7", "node-sass": "4.5.3", "npm-run-all": "4.0.2", "onchange": "3.2.1", "file-loader": "0.11.2", "http-server": "0.10.0", "imports-loader": "0.7.1", "json-loader": "0.5.7", "node-sass": "4.5.3", "npm-run-all": "4.0.2", "onchange": "3.2.1", "file-loader": "0.11.2", "http-server": "0.10.0", "imports-loader": "0.7.1", "json-loader": "0.5.7", "node-sass": "4.5.3", "npm-run-all": "4.0.2", "onchange": "3.2.1", "file-loader": "0.11.2", "http-server": "0.10.0", "imports-loader": "0.7.1", "json-loader": "0.5.7", "node-sass": "4.5.3", "npm-run-all": "4.0.2", "onchange": "3.2.1", "file-loader": "0.11.2", "http-server": "0.10.0", "imports-loader": "0.7.1", "json-loader": "0.5.7", "node-sass": "4.5.3", "npm-run-all": "4.0.2", "onchange": "3.2.1", "postcss-loader": "1.1.0", "raw-loader": "0.5.1", "react": "15.5.1", "react-addons-css-transition-group": "15.5.1", "react-dom": "15.5.1",
[ "keep", "keep", "keep", "keep", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
update development dependencies throughout (#1376) * update gulp dependencies * Update webpack loaders and misc tools * Update stylelint dependencies stylelint@8! postcss-url@7 supports copying assets so we can remove postcss-copy-assets entirely. (Note: resource paths are now dist/resources, not dist/assets) * Update karma dependencies, fix tests * upgrade site-landing dev deps
https://github.com/palantir/blueprint/commit/aac0f58792da928fe7fdff0bf543339f97a81ef3
packages/site-landing/package.json
"raw-loader": "0.5.1", "react": "15.5.1", "react-addons-css-transition-group": "15.5.1", "react-dom": "15.5.1", "sass-loader": "4.0.0", "style-loader": "0.13.1", "svgo": "0.7.1", "ts-loader": "0.8.2", "typescript": "2.1.5", "webpack": "1.13.3" }, "keywords": [ "blueprint",
</s> remove "file-loader": "0.9.0", "http-server": "0.9.0", "imports-loader": "0.6.5", "json-loader": "0.5.4", "node-sass": "3.8.0", "npm-run-all": "2.3.0", "onchange": "3.0.2", </s> add "file-loader": "0.11.2", "http-server": "0.10.0", "imports-loader": "0.7.1", "json-loader": "0.5.7", "node-sass": "4.5.3", "npm-run-all": "4.0.2", "onchange": "3.2.1", </s> remove "run-sequence": "1.2.2", </s> add "run-sequence": "2.0.0", </s> remove "merge-stream": "1.0.0", "mocha": "3.1.2", "node-sass-package-importer": "3.0.0", "npm-run-all": "3.1.1", "phantomjs-prebuilt": "2.1.13", "postcss-copy-assets": "0.3.0", "postcss-import": "8.2.0", "postcss-url": "5.1.2", </s> add "merge-stream": "1.0.1", "mocha": "3.4.2", "node-sass-package-importer": "3.0.4", "npm-run-all": "4.0.2", "phantomjs-prebuilt": "2.1.14", "postcss-import": "10.0.0", "postcss-url": "7.1.1", </s> remove "source-map-loader": "0.1.5", "string-replace-loader": "1.0.5", "stylelint": "7.9.0", "stylelint-config-palantir": "2.0.2", "stylelint-scss": "1.4.3", "ts-loader": "0.9.5", </s> add "source-map-loader": "0.2.1", "string-replace-loader": "1.3.0", "stylelint": "8.0.0", "stylelint-config-palantir": "2.1.0", "stylelint-config-standard": "17.0.0", "stylelint-scss": "1.5.1", "ts-loader": "1.3.3", </s> remove "resources/favicon.png": { to: ["assets/"], base: "resources/" }, </s> add "resources/favicon.png": { to: ["resources/"], base: "resources/" },
"sass-loader": "4.1.1", "style-loader": "0.18.2", "svgo": "0.7.2", "ts-loader": "1.3.3",
"raw-loader": "0.5.1", "react": "15.5.1", "react-addons-css-transition-group": "15.5.1", "react-dom": "15.5.1", "sass-loader": "4.1.1", "style-loader": "0.18.2", "svgo": "0.7.2", "ts-loader": "1.3.3", "sass-loader": "4.1.1", "style-loader": "0.18.2", "svgo": "0.7.2", "ts-loader": "1.3.3", "sass-loader": "4.1.1", "style-loader": "0.18.2", "svgo": "0.7.2", "ts-loader": "1.3.3", "sass-loader": "4.1.1", "style-loader": "0.18.2", "svgo": "0.7.2", "ts-loader": "1.3.3", "typescript": "2.1.5", "webpack": "1.13.3" }, "keywords": [ "blueprint",
[ "keep", "keep", "keep", "keep", "replace", "replace", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
update development dependencies throughout (#1376) * update gulp dependencies * Update webpack loaders and misc tools * Update stylelint dependencies stylelint@8! postcss-url@7 supports copying assets so we can remove postcss-copy-assets entirely. (Note: resource paths are now dist/resources, not dist/assets) * Update karma dependencies, fix tests * upgrade site-landing dev deps
https://github.com/palantir/blueprint/commit/aac0f58792da928fe7fdff0bf543339f97a81ef3
packages/site-landing/package.json
import { Grid, Rect } from "../common"; import { Batcher } from "../common/batcher"; import * as Classes from "../common/classes"; import { Utils } from "../index"; import { IClientCoordinates, ICoordinateData } from "../interactions/draggable"; import { DragReorderable, IReorderableProps } from "../interactions/reorderable"; import { Resizable } from "../interactions/resizable"; import { ILockableLayout, Orientation } from "../interactions/resizeHandle"; import { DragSelectable, ISelectableProps } from "../interactions/selectable";
</s> remove "selector-no-attribute": null </s> add "selector-max-universal": 1 </s> remove assert.equal(selectedDayElements.at(0).text(), minDate.getDate()); </s> add assert.equal(selectedDayElements.at(0).text(), minDate.getDate().toString()); </s> remove "lerna": "2.0.0-beta.30", </s> add "lerna": "2.0.0", </s> remove ignore: ["value"] </s> add "ignore": ["value"]
import { Utils } from "../common/utils";
import { Grid, Rect } from "../common"; import { Batcher } from "../common/batcher"; import * as Classes from "../common/classes"; import { Utils } from "../common/utils"; import { IClientCoordinates, ICoordinateData } from "../interactions/draggable"; import { DragReorderable, IReorderableProps } from "../interactions/reorderable"; import { Resizable } from "../interactions/resizable"; import { ILockableLayout, Orientation } from "../interactions/resizeHandle"; import { DragSelectable, ISelectableProps } from "../interactions/selectable";
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
update development dependencies throughout (#1376) * update gulp dependencies * Update webpack loaders and misc tools * Update stylelint dependencies stylelint@8! postcss-url@7 supports copying assets so we can remove postcss-copy-assets entirely. (Note: resource paths are now dist/resources, not dist/assets) * Update karma dependencies, fix tests * upgrade site-landing dev deps
https://github.com/palantir/blueprint/commit/aac0f58792da928fe7fdff0bf543339f97a81ef3
packages/table/src/headers/header.tsx
* @default false */ selectAllOnFocus?: boolean; /** Text value of controlled input. */ value?: string; /** Callback invoked when user cancels input with the `esc` key. Receives last confirmed value. */ onCancel?(value: string): void;
</s> remove <input ref={this.refHandlers.input} type="text" {...props} /> </s> add <input ref={this.refHandlers.input} type={type} {...props} /> </s> remove const { maxLength, multiline, placeholder } = this.props; </s> add const { maxLength, multiline, type, placeholder } = this.props;
/** * The type of input that should be shown, when not `multiline`. */ type?: string;
* @default false */ selectAllOnFocus?: boolean; /** * The type of input that should be shown, when not `multiline`. */ type?: string; /** Text value of controlled input. */ value?: string; /** Callback invoked when user cancels input with the `esc` key. Receives last confirmed value. */ onCancel?(value: string): void;
[ "keep", "keep", "keep", "add", "keep", "keep", "keep", "keep", "keep", "keep" ]
Added EditableText input type field (#3235)
https://github.com/palantir/blueprint/commit/ab3078a29e45eef4168dde64db1ec9b4adc2df5a
packages/core/src/components/editable-text/editableText.tsx
minLines: 1, minWidth: 80, multiline: false, placeholder: "Click to Edit", }; private valueElement: HTMLSpanElement; private refHandlers = { content: (spanElement: HTMLSpanElement) => { this.valueElement = spanElement;
</s> remove const { maxLength, multiline, placeholder } = this.props; </s> add const { maxLength, multiline, type, placeholder } = this.props; </s> remove <input ref={this.refHandlers.input} type="text" {...props} /> </s> add <input ref={this.refHandlers.input} type={type} {...props} />
type: "text",
minLines: 1, minWidth: 80, multiline: false, placeholder: "Click to Edit", type: "text", }; private valueElement: HTMLSpanElement; private refHandlers = { content: (spanElement: HTMLSpanElement) => { this.valueElement = spanElement;
[ "keep", "keep", "keep", "add", "keep", "keep", "keep", "keep", "keep", "keep" ]
Added EditableText input type field (#3235)
https://github.com/palantir/blueprint/commit/ab3078a29e45eef4168dde64db1ec9b4adc2df5a
packages/core/src/components/editable-text/editableText.tsx
} }; private maybeRenderInput(value: string) { const { maxLength, multiline, placeholder } = this.props; if (!this.state.isEditing) { return undefined; } const props: React.InputHTMLAttributes<HTMLInputElement | HTMLTextAreaElement> = { className: Classes.EDITABLE_TEXT_INPUT,
</s> remove <input ref={this.refHandlers.input} type="text" {...props} /> </s> add <input ref={this.refHandlers.input} type={type} {...props} />
const { maxLength, multiline, type, placeholder } = this.props;
} }; private maybeRenderInput(value: string) { const { maxLength, multiline, type, placeholder } = this.props; if (!this.state.isEditing) { return undefined; } const props: React.InputHTMLAttributes<HTMLInputElement | HTMLTextAreaElement> = { className: Classes.EDITABLE_TEXT_INPUT,
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
Added EditableText input type field (#3235)
https://github.com/palantir/blueprint/commit/ab3078a29e45eef4168dde64db1ec9b4adc2df5a
packages/core/src/components/editable-text/editableText.tsx
}; return multiline ? ( <textarea ref={this.refHandlers.input} {...props} /> ) : ( <input ref={this.refHandlers.input} type="text" {...props} /> ); } private updateInputDimensions() { if (this.valueElement != null) {
</s> remove const { maxLength, multiline, placeholder } = this.props; </s> add const { maxLength, multiline, type, placeholder } = this.props;
<input ref={this.refHandlers.input} type={type} {...props} />
}; return multiline ? ( <textarea ref={this.refHandlers.input} {...props} /> ) : ( <input ref={this.refHandlers.input} type={type} {...props} /> ); } private updateInputDimensions() { if (this.valueElement != null) {
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
Added EditableText input type field (#3235)
https://github.com/palantir/blueprint/commit/ab3078a29e45eef4168dde64db1ec9b4adc2df5a
packages/core/src/components/editable-text/editableText.tsx
*/ export interface IDatePickerLocaleUtils { formatDay: (day: Date, locale: string) => string; formatMonthTitle: (month: Date, locale: string) => string; formatWeekdayShort: (weekday: number, locale: string) => string; formatWeekdayLong: (weekday: number, locale: string) => string; getFirstDayOfWeek: (locale: string) => number;
</s> remove <DatePicker defaultValue={new Date(2015, 0, 5)} minDate={MIN_DATE} maxDate={MAX_DATE} />, </s> add <DatePicker defaultValue={new Date(2015, Months.JANUARY, 5)} minDate={MIN_DATE} maxDate={MAX_DATE} />, </s> remove <DatePicker value={new Date(2015, 0, 20)} minDate={MIN_DATE} maxDate={MAX_DATE} />, </s> add <DatePicker value={new Date(2015, Months.JANUARY, 20)} minDate={MIN_DATE} maxDate={MAX_DATE} />, </s> remove <DatePicker initialMonth={new Date(2015, 1, 12)} minDate={MIN_DATE} maxDate={MAX_DATE} />, </s> add <DatePicker initialMonth={new Date(2015, Months.FEBRUARY, 12)} minDate={MIN_DATE} maxDate={MAX_DATE} />, </s> remove assert.equal(dateRangePicker.state.displayMonth, DECEMBER); </s> add assert.equal(dateRangePicker.state.displayMonth, Months.DECEMBER); </s> remove const initialMonth = new Date(2015, 6, 1); </s> add const initialMonth = new Date(2015, Months.JULY, 1);
import { Months } from "./common/months";
*/ import { Months } from "./common/months"; export interface IDatePickerLocaleUtils { formatDay: (day: Date, locale: string) => string; formatMonthTitle: (month: Date, locale: string) => string; formatWeekdayShort: (weekday: number, locale: string) => string; formatWeekdayLong: (weekday: number, locale: string) => string; getFirstDayOfWeek: (locale: string) => number;
[ "keep", "add", "keep", "keep", "keep", "keep", "keep", "keep" ]
expose Months value mapping in datetime package (#439) * expose new `const enum Months` * replace all month numbers with enum values throughout code and tests * fixes #431
https://github.com/palantir/blueprint/commit/ab4f6a8587879913de2e57df0ac87ca51021ccca
packages/datetime/src/datePickerCore.tsx
export function getDefaultMaxDate() { const date = new Date(); date.setFullYear(date.getFullYear()); date.setMonth(11, 31); return date; } export function getDefaultMinDate() { const date = new Date();
</s> remove date.setMonth(0, 1); </s> add date.setMonth(Months.JANUARY, 1); </s> remove assert.equal(root.state("displayMonth"), 3); </s> add assert.equal(root.state("displayMonth"), Months.APRIL); </s> remove const maxDate = new Date(2020, 0); const minDate = new Date(2000, 0); </s> add const maxDate = new Date(2020, Months.JANUARY); const minDate = new Date(2000, Months.JANUARY); </s> remove return month === 12 ? [0, year + 1] : [month + 1, year]; </s> add return month === Months.DECEMBER ? [Months.JANUARY, year + 1] : [month + 1, year];
date.setMonth(Months.DECEMBER, 31);
export function getDefaultMaxDate() { const date = new Date(); date.setFullYear(date.getFullYear()); date.setMonth(Months.DECEMBER, 31); return date; } export function getDefaultMinDate() { const date = new Date();
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
expose Months value mapping in datetime package (#439) * expose new `const enum Months` * replace all month numbers with enum values throughout code and tests * fixes #431
https://github.com/palantir/blueprint/commit/ab4f6a8587879913de2e57df0ac87ca51021ccca
packages/datetime/src/datePickerCore.tsx
export function getDefaultMinDate() { const date = new Date(); date.setFullYear(date.getFullYear() - 20); date.setMonth(0, 1); return date; } export function combineModifiers(baseModifiers: IDatePickerModifiers, userModifiers: IDatePickerModifiers) { let modifiers = baseModifiers;
</s> remove date.setMonth(11, 31); </s> add date.setMonth(Months.DECEMBER, 31); </s> remove return month === 12 ? [0, year + 1] : [month + 1, year]; </s> add return month === Months.DECEMBER ? [Months.JANUARY, year + 1] : [month + 1, year]; </s> remove assert.equal(root.state("displayMonth"), 3); </s> add assert.equal(root.state("displayMonth"), Months.APRIL); </s> remove assert.strictEqual(dateRangePicker.state.displayMonth, 1); </s> add assert.strictEqual(dateRangePicker.state.displayMonth, Months.FEBRUARY);
date.setMonth(Months.JANUARY, 1);
export function getDefaultMinDate() { const date = new Date(); date.setFullYear(date.getFullYear() - 20); date.setMonth(Months.JANUARY, 1); return date; } export function combineModifiers(baseModifiers: IDatePickerModifiers, userModifiers: IDatePickerModifiers) { let modifiers = baseModifiers;
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
expose Months value mapping in datetime package (#439) * expose new `const enum Months` * replace all month numbers with enum values throughout code and tests * fixes #431
https://github.com/palantir/blueprint/commit/ab4f6a8587879913de2e57df0ac87ca51021ccca
packages/datetime/src/datePickerCore.tsx
import { DateRange } from "./common/dateUtils"; import * as Errors from "./common/errors"; import { DatePickerCaption } from "./datePickerCaption"; import { combineModifiers, getDefaultMaxDate,
</s> remove renderDateRangePicker({ initialMonth: new Date(2015, 2, 2), value: [null, null] }); assert.equal(dateRangePicker.state.displayMonth, 2); </s> add renderDateRangePicker({ initialMonth: new Date(2015, Months.MARCH, 2), value: [null, null] }); assert.equal(dateRangePicker.state.displayMonth, Months.MARCH);
import { Months } from "./common/months";
import { DateRange } from "./common/dateUtils"; import * as Errors from "./common/errors"; import { Months } from "./common/months"; import { DatePickerCaption } from "./datePickerCaption"; import { combineModifiers, getDefaultMaxDate,
[ "keep", "add", "keep", "keep", "keep", "keep", "keep" ]
expose Months value mapping in datetime package (#439) * expose new `const enum Months` * replace all month numbers with enum values throughout code and tests * fixes #431
https://github.com/palantir/blueprint/commit/ab4f6a8587879913de2e57df0ac87ca51021ccca
packages/datetime/src/dateRangePicker.tsx
type DisplayMonth = [number, number]; function getNextMonth([month, year]: DisplayMonth): DisplayMonth { return month === 12 ? [0, year + 1] : [month + 1, year]; } function areSameMonth([month, year]: DisplayMonth, [month2, year2]: DisplayMonth) { return month === month2 && year === year2; }
</s> remove date.setMonth(11, 31); </s> add date.setMonth(Months.DECEMBER, 31); </s> remove date.setMonth(0, 1); </s> add date.setMonth(Months.JANUARY, 1); </s> remove const DECEMBER = 11; </s> add </s> remove const minDate = new Date(2015, 0, 5); const initialMonth = new Date(2015, 1, 5); </s> add const minDate = new Date(2015, Months.JANUARY, 5); const initialMonth = new Date(2015, Months.FEBRUARY, 5); </s> remove const initialMonth = new Date(YEAR, DECEMBER, 11); const maxDate = new Date(YEAR, DECEMBER, 15); const minDate = new Date(YEAR, DECEMBER, 1); </s> add const initialMonth = new Date(YEAR, Months.DECEMBER, 11); const maxDate = new Date(YEAR, Months.DECEMBER, 15); const minDate = new Date(YEAR, Months.DECEMBER, 1);
return month === Months.DECEMBER ? [Months.JANUARY, year + 1] : [month + 1, year];
type DisplayMonth = [number, number]; function getNextMonth([month, year]: DisplayMonth): DisplayMonth { return month === Months.DECEMBER ? [Months.JANUARY, year + 1] : [month + 1, year]; } function areSameMonth([month, year]: DisplayMonth, [month2, year2]: DisplayMonth) { return month === month2 && year === year2; }
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
expose Months value mapping in datetime package (#439) * expose new `const enum Months` * replace all month numbers with enum values throughout code and tests * fixes #431
https://github.com/palantir/blueprint/commit/ab4f6a8587879913de2e57df0ac87ca51021ccca
packages/datetime/src/dateRangePicker.tsx
export const Classes = classes; export { DateRange } from "./common/dateUtils"; export { DateInput } from "./dateInput"; export { DatePicker, DatePickerFactory, IDatePickerProps } from "./datePicker"; export { IDatePickerLocaleUtils, IDatePickerModifiers } from "./datePickerCore"; export { DateTimePicker, IDateTimePickerProps } from "./dateTimePicker"; export { DateRangePicker, DateRangePickerFactory, IDateRangePickerProps, IDateRangeShortcut } from "./dateRangePicker";
</s> remove date.setMonth(11, 31); </s> add date.setMonth(Months.DECEMBER, 31);
export { Months } from "./common/months";
export const Classes = classes; export { DateRange } from "./common/dateUtils"; export { Months } from "./common/months"; export { DateInput } from "./dateInput"; export { DatePicker, DatePickerFactory, IDatePickerProps } from "./datePicker"; export { IDatePickerLocaleUtils, IDatePickerModifiers } from "./datePickerCore"; export { DateTimePicker, IDateTimePickerProps } from "./dateTimePicker"; export { DateRangePicker, DateRangePickerFactory, IDateRangePickerProps, IDateRangeShortcut } from "./dateRangePicker";
[ "keep", "keep", "add", "keep", "keep", "keep", "keep", "keep" ]
expose Months value mapping in datetime package (#439) * expose new `const enum Months` * replace all month numbers with enum values throughout code and tests * fixes #431
https://github.com/palantir/blueprint/commit/ab4f6a8587879913de2e57df0ac87ca51021ccca
packages/datetime/src/index.ts
import { Button } from "@blueprintjs/core"; import * as DateUtils from "../src/common/dateUtils"; import * as Errors from "../src/common/errors"; import { Classes, DatePicker } from "../src/index"; describe("<DatePicker>", () => { it(`renders .${Classes.DATEPICKER}`, () => {
</s> remove renderDateRangePicker({ initialMonth: new Date(2015, 2, 2), value: [null, null] }); assert.equal(dateRangePicker.state.displayMonth, 2); </s> add renderDateRangePicker({ initialMonth: new Date(2015, Months.MARCH, 2), value: [null, null] }); assert.equal(dateRangePicker.state.displayMonth, Months.MARCH);
import { Months } from "../src/common/months";
import { Button } from "@blueprintjs/core"; import * as DateUtils from "../src/common/dateUtils"; import * as Errors from "../src/common/errors"; import { Months } from "../src/common/months"; import { Classes, DatePicker } from "../src/index"; describe("<DatePicker>", () => { it(`renders .${Classes.DATEPICKER}`, () => {
[ "keep", "keep", "keep", "add", "keep", "keep", "keep", "keep" ]
expose Months value mapping in datetime package (#439) * expose new `const enum Months` * replace all month numbers with enum values throughout code and tests * fixes #431
https://github.com/palantir/blueprint/commit/ab4f6a8587879913de2e57df0ac87ca51021ccca
packages/datetime/test/datePickerTests.tsx
}); describe("initially displayed month", () => { it("is defaultValue", () => { const defaultValue = new Date(2007, 3, 4); const { root } = wrap(<DatePicker defaultValue={defaultValue} />); assert.equal(root.state("displayYear"), 2007); assert.equal(root.state("displayMonth"), 3); });
</s> remove assert.equal(root.state("displayMonth"), 3); </s> add assert.equal(root.state("displayMonth"), Months.APRIL); </s> remove const defaultValue = new Date(2007, 3, 4); const initialMonth = new Date(2002, 2, 1); </s> add const defaultValue = new Date(2007, Months.APRIL, 4); const initialMonth = new Date(2002, Months.MARCH, 1); </s> remove const value = new Date(2007, 3, 4); </s> add const value = new Date(2007, Months.APRIL, 4); </s> remove assert.equal(root.state("displayMonth"), 2); </s> add assert.equal(root.state("displayMonth"), Months.MARCH); </s> remove const defaultValue = new Date(2007, 3, 4); </s> add const defaultValue = new Date(2007, Months.APRIL, 4);
const defaultValue = new Date(2007, Months.APRIL, 4);
}); describe("initially displayed month", () => { it("is defaultValue", () => { const defaultValue = new Date(2007, Months.APRIL, 4); const { root } = wrap(<DatePicker defaultValue={defaultValue} />); assert.equal(root.state("displayYear"), 2007); assert.equal(root.state("displayMonth"), 3); });
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
expose Months value mapping in datetime package (#439) * expose new `const enum Months` * replace all month numbers with enum values throughout code and tests * fixes #431
https://github.com/palantir/blueprint/commit/ab4f6a8587879913de2e57df0ac87ca51021ccca
packages/datetime/test/datePickerTests.tsx
it("is defaultValue", () => { const defaultValue = new Date(2007, 3, 4); const { root } = wrap(<DatePicker defaultValue={defaultValue} />); assert.equal(root.state("displayYear"), 2007); assert.equal(root.state("displayMonth"), 3); }); it("is initialMonth if set (overrides defaultValue)", () => { const defaultValue = new Date(2007, 3, 4); const initialMonth = new Date(2002, 2, 1);
</s> remove const defaultValue = new Date(2007, 3, 4); const initialMonth = new Date(2002, 2, 1); </s> add const defaultValue = new Date(2007, Months.APRIL, 4); const initialMonth = new Date(2002, Months.MARCH, 1); </s> remove const defaultValue = new Date(2007, 3, 4); </s> add const defaultValue = new Date(2007, Months.APRIL, 4); </s> remove assert.equal(root.state("displayMonth"), 2); </s> add assert.equal(root.state("displayMonth"), Months.MARCH); </s> remove const value = new Date(2007, 3, 4); </s> add const value = new Date(2007, Months.APRIL, 4); </s> remove const defaultValue = new Date(2007, 3, 4); </s> add const defaultValue = new Date(2007, Months.APRIL, 4);
assert.equal(root.state("displayMonth"), Months.APRIL);
it("is defaultValue", () => { const defaultValue = new Date(2007, 3, 4); const { root } = wrap(<DatePicker defaultValue={defaultValue} />); assert.equal(root.state("displayYear"), 2007); assert.equal(root.state("displayMonth"), Months.APRIL); }); it("is initialMonth if set (overrides defaultValue)", () => { const defaultValue = new Date(2007, 3, 4); const initialMonth = new Date(2002, 2, 1);
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
expose Months value mapping in datetime package (#439) * expose new `const enum Months` * replace all month numbers with enum values throughout code and tests * fixes #431
https://github.com/palantir/blueprint/commit/ab4f6a8587879913de2e57df0ac87ca51021ccca
packages/datetime/test/datePickerTests.tsx
assert.equal(root.state("displayMonth"), 3); }); it("is initialMonth if set (overrides defaultValue)", () => { const defaultValue = new Date(2007, 3, 4); const initialMonth = new Date(2002, 2, 1); const { root } = wrap(<DatePicker defaultValue={defaultValue} initialMonth={initialMonth} />); assert.equal(root.state("displayYear"), 2002); assert.equal(root.state("displayMonth"), 2); });
</s> remove assert.equal(root.state("displayMonth"), 3); </s> add assert.equal(root.state("displayMonth"), Months.APRIL); </s> remove assert.equal(root.state("displayMonth"), 2); </s> add assert.equal(root.state("displayMonth"), Months.MARCH); </s> remove const defaultValue = new Date(2007, 3, 4); </s> add const defaultValue = new Date(2007, Months.APRIL, 4); </s> remove const value = new Date(2007, 3, 4); </s> add const value = new Date(2007, Months.APRIL, 4); </s> remove assert.equal(root.state("displayMonth"), 3); </s> add assert.equal(root.state("displayMonth"), Months.APRIL);
const defaultValue = new Date(2007, Months.APRIL, 4); const initialMonth = new Date(2002, Months.MARCH, 1);
assert.equal(root.state("displayMonth"), 3); }); it("is initialMonth if set (overrides defaultValue)", () => { const defaultValue = new Date(2007, Months.APRIL, 4); const initialMonth = new Date(2002, Months.MARCH, 1); const defaultValue = new Date(2007, Months.APRIL, 4); const initialMonth = new Date(2002, Months.MARCH, 1); const { root } = wrap(<DatePicker defaultValue={defaultValue} initialMonth={initialMonth} />); assert.equal(root.state("displayYear"), 2002); assert.equal(root.state("displayMonth"), 2); });
[ "keep", "keep", "keep", "keep", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
expose Months value mapping in datetime package (#439) * expose new `const enum Months` * replace all month numbers with enum values throughout code and tests * fixes #431
https://github.com/palantir/blueprint/commit/ab4f6a8587879913de2e57df0ac87ca51021ccca
packages/datetime/test/datePickerTests.tsx
const defaultValue = new Date(2007, 3, 4); const initialMonth = new Date(2002, 2, 1); const { root } = wrap(<DatePicker defaultValue={defaultValue} initialMonth={initialMonth} />); assert.equal(root.state("displayYear"), 2002); assert.equal(root.state("displayMonth"), 2); }); it("is value if set and initialMonth not set", () => { const value = new Date(2007, 3, 4); const { root } = wrap(<DatePicker value={value} />);
</s> remove const defaultValue = new Date(2007, 3, 4); const initialMonth = new Date(2002, 2, 1); </s> add const defaultValue = new Date(2007, Months.APRIL, 4); const initialMonth = new Date(2002, Months.MARCH, 1); </s> remove const value = new Date(2007, 3, 4); </s> add const value = new Date(2007, Months.APRIL, 4); </s> remove assert.equal(root.state("displayMonth"), 3); </s> add assert.equal(root.state("displayMonth"), Months.APRIL); </s> remove assert.equal(root.state("displayMonth"), 3); </s> add assert.equal(root.state("displayMonth"), Months.APRIL); </s> remove const defaultValue = new Date(2007, 3, 4); </s> add const defaultValue = new Date(2007, Months.APRIL, 4);
assert.equal(root.state("displayMonth"), Months.MARCH);
const defaultValue = new Date(2007, 3, 4); const initialMonth = new Date(2002, 2, 1); const { root } = wrap(<DatePicker defaultValue={defaultValue} initialMonth={initialMonth} />); assert.equal(root.state("displayYear"), 2002); assert.equal(root.state("displayMonth"), Months.MARCH); }); it("is value if set and initialMonth not set", () => { const value = new Date(2007, 3, 4); const { root } = wrap(<DatePicker value={value} />);
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
expose Months value mapping in datetime package (#439) * expose new `const enum Months` * replace all month numbers with enum values throughout code and tests * fixes #431
https://github.com/palantir/blueprint/commit/ab4f6a8587879913de2e57df0ac87ca51021ccca
packages/datetime/test/datePickerTests.tsx
assert.equal(root.state("displayMonth"), 2); }); it("is value if set and initialMonth not set", () => { const value = new Date(2007, 3, 4); const { root } = wrap(<DatePicker value={value} />); assert.equal(root.state("displayYear"), 2007); assert.equal(root.state("displayMonth"), 3); });
</s> remove assert.equal(root.state("displayMonth"), 3); </s> add assert.equal(root.state("displayMonth"), Months.APRIL); </s> remove assert.equal(root.state("displayMonth"), 2); </s> add assert.equal(root.state("displayMonth"), Months.MARCH); </s> remove assert.equal(root.state("displayMonth"), 3); </s> add assert.equal(root.state("displayMonth"), Months.APRIL); </s> remove const defaultValue = new Date(2007, 3, 4); </s> add const defaultValue = new Date(2007, Months.APRIL, 4); </s> remove const defaultValue = new Date(2007, 3, 4); const initialMonth = new Date(2002, 2, 1); </s> add const defaultValue = new Date(2007, Months.APRIL, 4); const initialMonth = new Date(2002, Months.MARCH, 1);
const value = new Date(2007, Months.APRIL, 4);
assert.equal(root.state("displayMonth"), 2); }); it("is value if set and initialMonth not set", () => { const value = new Date(2007, Months.APRIL, 4); const { root } = wrap(<DatePicker value={value} />); assert.equal(root.state("displayYear"), 2007); assert.equal(root.state("displayMonth"), 3); });
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
expose Months value mapping in datetime package (#439) * expose new `const enum Months` * replace all month numbers with enum values throughout code and tests * fixes #431
https://github.com/palantir/blueprint/commit/ab4f6a8587879913de2e57df0ac87ca51021ccca
packages/datetime/test/datePickerTests.tsx
it("is value if set and initialMonth not set", () => { const value = new Date(2007, 3, 4); const { root } = wrap(<DatePicker value={value} />); assert.equal(root.state("displayYear"), 2007); assert.equal(root.state("displayMonth"), 3); }); it("is today if today is within date range", () => { const today = new Date(); const { root } = wrap(<DatePicker />);
</s> remove const value = new Date(2007, 3, 4); </s> add const value = new Date(2007, Months.APRIL, 4); </s> remove assert.equal(root.state("displayMonth"), 2); </s> add assert.equal(root.state("displayMonth"), Months.MARCH); </s> remove assert.equal(root.state("displayMonth"), 3); </s> add assert.equal(root.state("displayMonth"), Months.APRIL); </s> remove const defaultValue = new Date(2007, 3, 4); </s> add const defaultValue = new Date(2007, Months.APRIL, 4); </s> remove assert.equal(dateRangePicker.state.displayMonth, 3); </s> add assert.equal(dateRangePicker.state.displayMonth, Months.APRIL);
assert.equal(root.state("displayMonth"), Months.APRIL);
it("is value if set and initialMonth not set", () => { const value = new Date(2007, 3, 4); const { root } = wrap(<DatePicker value={value} />); assert.equal(root.state("displayYear"), 2007); assert.equal(root.state("displayMonth"), Months.APRIL); }); it("is today if today is within date range", () => { const today = new Date(); const { root } = wrap(<DatePicker />);
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
expose Months value mapping in datetime package (#439) * expose new `const enum Months` * replace all month numbers with enum values throughout code and tests * fixes #431
https://github.com/palantir/blueprint/commit/ab4f6a8587879913de2e57df0ac87ca51021ccca
packages/datetime/test/datePickerTests.tsx
assert.equal(root.state("displayMonth"), today.getMonth()); }); it("is a day between minDate and maxDate if today is not in range", () => { const maxDate = new Date(2005, 0); const minDate = new Date(2000, 0); const { root } = wrap(<DatePicker maxDate={maxDate} minDate={minDate} />); assert.isTrue(DateUtils.isDayInRange( new Date(root.state("displayYear"), root.state("displayMonth")), [minDate, maxDate]), );
</s> remove const maxDate = new Date(2005, 0); const minDate = new Date(2000, 0); </s> add const maxDate = new Date(2005, Months.JANUARY); const minDate = new Date(2000, Months.JANUARY); </s> remove const maxDate = new Date(2020, 0); const minDate = new Date(2000, 0); </s> add const maxDate = new Date(2020, Months.JANUARY); const minDate = new Date(2000, Months.JANUARY); </s> remove assert.equal(root.state("displayMonth"), 3); </s> add assert.equal(root.state("displayMonth"), Months.APRIL); </s> remove assert.equal(dateRangePicker.state.displayMonth, 3); </s> add assert.equal(dateRangePicker.state.displayMonth, Months.APRIL); </s> remove const initialMonth = new Date(2015, 6, 1); const minDate = new Date(2015, 2, 13); const maxDate = new Date(2015, 10, 21); </s> add const initialMonth = new Date(2015, Months.JULY, 1); const minDate = new Date(2015, Months.MARCH, 13); const maxDate = new Date(2015, Months.NOVEMBER, 21);
const maxDate = new Date(2005, Months.JANUARY); const minDate = new Date(2000, Months.JANUARY);
assert.equal(root.state("displayMonth"), today.getMonth()); }); it("is a day between minDate and maxDate if today is not in range", () => { const maxDate = new Date(2005, Months.JANUARY); const minDate = new Date(2000, Months.JANUARY); const maxDate = new Date(2005, Months.JANUARY); const minDate = new Date(2000, Months.JANUARY); const { root } = wrap(<DatePicker maxDate={maxDate} minDate={minDate} />); assert.isTrue(DateUtils.isDayInRange( new Date(root.state("displayYear"), root.state("displayMonth")), [minDate, maxDate]), );
[ "keep", "keep", "keep", "keep", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
expose Months value mapping in datetime package (#439) * expose new `const enum Months` * replace all month numbers with enum values throughout code and tests * fixes #431
https://github.com/palantir/blueprint/commit/ab4f6a8587879913de2e57df0ac87ca51021ccca
packages/datetime/test/datePickerTests.tsx
); }); it("selectedDay is set to the day of the value", () => { const value = new Date(2007, 3, 4); const { root } = wrap(<DatePicker value={value} />); assert.strictEqual(root.state("selectedDay"), value.getDate()); }); it("selectedDay is set to the day of the defaultValue", () => {
</s> remove const defaultValue = new Date(2007, 3, 4); </s> add const defaultValue = new Date(2007, Months.APRIL, 4); </s> remove const value = new Date(2007, 3, 4); </s> add const value = new Date(2007, Months.APRIL, 4); </s> remove assert.equal(root.state("displayMonth"), 3); </s> add assert.equal(root.state("displayMonth"), Months.APRIL); </s> remove assert.equal(root.state("displayMonth"), 2); </s> add assert.equal(root.state("displayMonth"), Months.MARCH); </s> remove assert.equal(root.state("displayMonth"), 3); </s> add assert.equal(root.state("displayMonth"), Months.APRIL);
const value = new Date(2007, Months.APRIL, 4);
); }); it("selectedDay is set to the day of the value", () => { const value = new Date(2007, Months.APRIL, 4); const { root } = wrap(<DatePicker value={value} />); assert.strictEqual(root.state("selectedDay"), value.getDate()); }); it("selectedDay is set to the day of the defaultValue", () => {
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
expose Months value mapping in datetime package (#439) * expose new `const enum Months` * replace all month numbers with enum values throughout code and tests * fixes #431
https://github.com/palantir/blueprint/commit/ab4f6a8587879913de2e57df0ac87ca51021ccca
packages/datetime/test/datePickerTests.tsx
assert.strictEqual(root.state("selectedDay"), value.getDate()); }); it("selectedDay is set to the day of the defaultValue", () => { const defaultValue = new Date(2007, 3, 4); const { root } = wrap(<DatePicker defaultValue={defaultValue} />); assert.strictEqual(root.state("selectedDay"), defaultValue.getDate()); }); });
</s> remove const value = new Date(2007, 3, 4); </s> add const value = new Date(2007, Months.APRIL, 4); </s> remove const defaultValue = new Date(2007, 3, 4); </s> add const defaultValue = new Date(2007, Months.APRIL, 4); </s> remove assert.equal(root.state("displayMonth"), 3); </s> add assert.equal(root.state("displayMonth"), Months.APRIL); </s> remove assert.equal(root.state("displayMonth"), 2); </s> add assert.equal(root.state("displayMonth"), Months.MARCH); </s> remove const defaultValue = new Date(2007, 3, 4); const initialMonth = new Date(2002, 2, 1); </s> add const defaultValue = new Date(2007, Months.APRIL, 4); const initialMonth = new Date(2002, Months.MARCH, 1);
const defaultValue = new Date(2007, Months.APRIL, 4);
assert.strictEqual(root.state("selectedDay"), value.getDate()); }); it("selectedDay is set to the day of the defaultValue", () => { const defaultValue = new Date(2007, Months.APRIL, 4); const { root } = wrap(<DatePicker defaultValue={defaultValue} />); assert.strictEqual(root.state("selectedDay"), defaultValue.getDate()); }); });
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
expose Months value mapping in datetime package (#439) * expose new `const enum Months` * replace all month numbers with enum values throughout code and tests * fixes #431
https://github.com/palantir/blueprint/commit/ab4f6a8587879913de2e57df0ac87ca51021ccca
packages/datetime/test/datePickerTests.tsx
}); }); describe("minDate/maxDate bounds", () => { const MIN_DATE = new Date(2015, 0, 7); const MAX_DATE = new Date(2015, 0, 12); it("maxDate must be later than minDate", () => { assert.throws(() => wrap( <DatePicker maxDate={MIN_DATE} minDate={MAX_DATE} />, ), Errors.DATEPICKER_MAX_DATE_INVALID); });
</s> remove const minDate = new Date(2000, 0, 10); const maxDate = new Date(2000, 0, 8); </s> add const minDate = new Date(2000, Months.JANUARY, 10); const maxDate = new Date(2000, Months.JANUARY, 8); </s> remove assert.equal(dateRangePicker.state.displayMonth, DECEMBER); </s> add assert.equal(dateRangePicker.state.displayMonth, Months.DECEMBER); </s> remove const minDate = new Date(2015, 0, 5); const maxDate = new Date(2015, 0, 7); const initialMonth = new Date(2015, 1, 12); </s> add const minDate = new Date(2015, Months.JANUARY, 5); const maxDate = new Date(2015, Months.JANUARY, 7); const initialMonth = new Date(2015, Months.FEBRUARY, 12); </s> remove const minDate = new Date(2015, 0, 5); const maxDate = new Date(2015, 0, 7); const initialMonth = new Date(2015, 0, 12); </s> add const minDate = new Date(2015, Months.JANUARY, 5); const maxDate = new Date(2015, Months.JANUARY, 7); const initialMonth = new Date(2015, Months.JANUARY, 12); </s> remove <DatePicker defaultValue={new Date(2015, 0, 5)} minDate={MIN_DATE} maxDate={MAX_DATE} />, </s> add <DatePicker defaultValue={new Date(2015, Months.JANUARY, 5)} minDate={MIN_DATE} maxDate={MAX_DATE} />,
const MIN_DATE = new Date(2015, Months.JANUARY, 7); const MAX_DATE = new Date(2015, Months.JANUARY, 12);
}); }); describe("minDate/maxDate bounds", () => { const MIN_DATE = new Date(2015, Months.JANUARY, 7); const MAX_DATE = new Date(2015, Months.JANUARY, 12); const MIN_DATE = new Date(2015, Months.JANUARY, 7); const MAX_DATE = new Date(2015, Months.JANUARY, 12); it("maxDate must be later than minDate", () => { assert.throws(() => wrap( <DatePicker maxDate={MIN_DATE} minDate={MAX_DATE} />, ), Errors.DATEPICKER_MAX_DATE_INVALID); });
[ "keep", "keep", "keep", "keep", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
expose Months value mapping in datetime package (#439) * expose new `const enum Months` * replace all month numbers with enum values throughout code and tests * fixes #431
https://github.com/palantir/blueprint/commit/ab4f6a8587879913de2e57df0ac87ca51021ccca
packages/datetime/test/datePickerTests.tsx
}); it("an error is thrown if defaultValue is outside bounds", () => { assert.throws(() => wrap( <DatePicker defaultValue={new Date(2015, 0, 5)} minDate={MIN_DATE} maxDate={MAX_DATE} />, ), Errors.DATEPICKER_DEFAULT_VALUE_INVALID); }); it("an error is thrown if value is outside bounds", () => { assert.throws(() => wrap(
</s> remove <DatePicker value={new Date(2015, 0, 20)} minDate={MIN_DATE} maxDate={MAX_DATE} />, </s> add <DatePicker value={new Date(2015, Months.JANUARY, 20)} minDate={MIN_DATE} maxDate={MAX_DATE} />, </s> remove <DatePicker initialMonth={new Date(2015, 1, 12)} minDate={MIN_DATE} maxDate={MAX_DATE} />, </s> add <DatePicker initialMonth={new Date(2015, Months.FEBRUARY, 12)} minDate={MIN_DATE} maxDate={MAX_DATE} />, </s> remove <DatePicker initialMonth={new Date(2015, 0, 12)} minDate={MIN_DATE} maxDate={MAX_DATE} />, </s> add <DatePicker initialMonth={new Date(2015, Months.JANUARY, 12)} minDate={MIN_DATE} maxDate={MAX_DATE} />, </s> remove const minDate = new Date(2015, 0, 5); const maxDate = new Date(2015, 0, 7); const defaultValue = [new Date(2015, 0, 12), null] as DateRange; </s> add const minDate = new Date(2015, Months.JANUARY, 5); const maxDate = new Date(2015, Months.JANUARY, 7); const defaultValue = [new Date(2015, Months.JANUARY, 12), null] as DateRange; </s> remove const minDate = new Date(2015, 0, 5); const maxDate = new Date(2015, 0, 7); const value = [new Date(2015, 0, 12), null] as DateRange; </s> add const minDate = new Date(2015, Months.JANUARY, 5); const maxDate = new Date(2015, Months.JANUARY, 7); const value = [new Date(2015, Months.JANUARY, 12), null] as DateRange;
<DatePicker defaultValue={new Date(2015, Months.JANUARY, 5)} minDate={MIN_DATE} maxDate={MAX_DATE} />,
}); it("an error is thrown if defaultValue is outside bounds", () => { assert.throws(() => wrap( <DatePicker defaultValue={new Date(2015, Months.JANUARY, 5)} minDate={MIN_DATE} maxDate={MAX_DATE} />, ), Errors.DATEPICKER_DEFAULT_VALUE_INVALID); }); it("an error is thrown if value is outside bounds", () => { assert.throws(() => wrap(
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
expose Months value mapping in datetime package (#439) * expose new `const enum Months` * replace all month numbers with enum values throughout code and tests * fixes #431
https://github.com/palantir/blueprint/commit/ab4f6a8587879913de2e57df0ac87ca51021ccca
packages/datetime/test/datePickerTests.tsx
}); it("an error is thrown if value is outside bounds", () => { assert.throws(() => wrap( <DatePicker value={new Date(2015, 0, 20)} minDate={MIN_DATE} maxDate={MAX_DATE} />, ), Errors.DATEPICKER_VALUE_INVALID); }); it("an error is thrown if initialMonth is outside month bounds", () => { assert.throws(() => wrap(
</s> remove <DatePicker defaultValue={new Date(2015, 0, 5)} minDate={MIN_DATE} maxDate={MAX_DATE} />, </s> add <DatePicker defaultValue={new Date(2015, Months.JANUARY, 5)} minDate={MIN_DATE} maxDate={MAX_DATE} />, </s> remove <DatePicker initialMonth={new Date(2015, 1, 12)} minDate={MIN_DATE} maxDate={MAX_DATE} />, </s> add <DatePicker initialMonth={new Date(2015, Months.FEBRUARY, 12)} minDate={MIN_DATE} maxDate={MAX_DATE} />, </s> remove <DatePicker initialMonth={new Date(2015, 0, 12)} minDate={MIN_DATE} maxDate={MAX_DATE} />, </s> add <DatePicker initialMonth={new Date(2015, Months.JANUARY, 12)} minDate={MIN_DATE} maxDate={MAX_DATE} />, </s> remove const minDate = new Date(2015, 0, 5); const maxDate = new Date(2015, 0, 7); const initialMonth = new Date(2015, 1, 12); </s> add const minDate = new Date(2015, Months.JANUARY, 5); const maxDate = new Date(2015, Months.JANUARY, 7); const initialMonth = new Date(2015, Months.FEBRUARY, 12); </s> remove const minDate = new Date(2015, 0, 5); const maxDate = new Date(2015, 0, 7); const value = [new Date(2015, 0, 12), null] as DateRange; </s> add const minDate = new Date(2015, Months.JANUARY, 5); const maxDate = new Date(2015, Months.JANUARY, 7); const value = [new Date(2015, Months.JANUARY, 12), null] as DateRange;
<DatePicker value={new Date(2015, Months.JANUARY, 20)} minDate={MIN_DATE} maxDate={MAX_DATE} />,
}); it("an error is thrown if value is outside bounds", () => { assert.throws(() => wrap( <DatePicker value={new Date(2015, Months.JANUARY, 20)} minDate={MIN_DATE} maxDate={MAX_DATE} />, ), Errors.DATEPICKER_VALUE_INVALID); }); it("an error is thrown if initialMonth is outside month bounds", () => { assert.throws(() => wrap(
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
expose Months value mapping in datetime package (#439) * expose new `const enum Months` * replace all month numbers with enum values throughout code and tests * fixes #431
https://github.com/palantir/blueprint/commit/ab4f6a8587879913de2e57df0ac87ca51021ccca
packages/datetime/test/datePickerTests.tsx
}); it("an error is thrown if initialMonth is outside month bounds", () => { assert.throws(() => wrap( <DatePicker initialMonth={new Date(2015, 1, 12)} minDate={MIN_DATE} maxDate={MAX_DATE} />, ), Errors.DATEPICKER_INITIAL_MONTH_INVALID); }); it("an error is not thrown if initialMonth is outside day bounds but inside month bounds", () => { assert.doesNotThrow(() => wrap(
</s> remove <DatePicker initialMonth={new Date(2015, 0, 12)} minDate={MIN_DATE} maxDate={MAX_DATE} />, </s> add <DatePicker initialMonth={new Date(2015, Months.JANUARY, 12)} minDate={MIN_DATE} maxDate={MAX_DATE} />, </s> remove <DatePicker value={new Date(2015, 0, 20)} minDate={MIN_DATE} maxDate={MAX_DATE} />, </s> add <DatePicker value={new Date(2015, Months.JANUARY, 20)} minDate={MIN_DATE} maxDate={MAX_DATE} />, </s> remove <DatePicker defaultValue={new Date(2015, 0, 5)} minDate={MIN_DATE} maxDate={MAX_DATE} />, </s> add <DatePicker defaultValue={new Date(2015, Months.JANUARY, 5)} minDate={MIN_DATE} maxDate={MAX_DATE} />, </s> remove const minDate = new Date(2015, 0, 5); const maxDate = new Date(2015, 0, 7); const initialMonth = new Date(2015, 0, 12); </s> add const minDate = new Date(2015, Months.JANUARY, 5); const maxDate = new Date(2015, Months.JANUARY, 7); const initialMonth = new Date(2015, Months.JANUARY, 12); </s> remove const minDate = new Date(2015, 0, 5); const maxDate = new Date(2015, 0, 7); const initialMonth = new Date(2015, 1, 12); </s> add const minDate = new Date(2015, Months.JANUARY, 5); const maxDate = new Date(2015, Months.JANUARY, 7); const initialMonth = new Date(2015, Months.FEBRUARY, 12);
<DatePicker initialMonth={new Date(2015, Months.FEBRUARY, 12)} minDate={MIN_DATE} maxDate={MAX_DATE} />,
}); it("an error is thrown if initialMonth is outside month bounds", () => { assert.throws(() => wrap( <DatePicker initialMonth={new Date(2015, Months.FEBRUARY, 12)} minDate={MIN_DATE} maxDate={MAX_DATE} />, ), Errors.DATEPICKER_INITIAL_MONTH_INVALID); }); it("an error is not thrown if initialMonth is outside day bounds but inside month bounds", () => { assert.doesNotThrow(() => wrap(
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
expose Months value mapping in datetime package (#439) * expose new `const enum Months` * replace all month numbers with enum values throughout code and tests * fixes #431
https://github.com/palantir/blueprint/commit/ab4f6a8587879913de2e57df0ac87ca51021ccca
packages/datetime/test/datePickerTests.tsx
}); it("an error is not thrown if initialMonth is outside day bounds but inside month bounds", () => { assert.doesNotThrow(() => wrap( <DatePicker initialMonth={new Date(2015, 0, 12)} minDate={MIN_DATE} maxDate={MAX_DATE} />, )); }); it("only days outside bounds have disabled class", () => { const minDate = new Date(2000, 0, 10);
</s> remove <DatePicker initialMonth={new Date(2015, 1, 12)} minDate={MIN_DATE} maxDate={MAX_DATE} />, </s> add <DatePicker initialMonth={new Date(2015, Months.FEBRUARY, 12)} minDate={MIN_DATE} maxDate={MAX_DATE} />, </s> remove const minDate = new Date(2000, 0, 10); </s> add const minDate = new Date(2000, Months.JANUARY, 10); </s> remove <DatePicker value={new Date(2015, 0, 20)} minDate={MIN_DATE} maxDate={MAX_DATE} />, </s> add <DatePicker value={new Date(2015, Months.JANUARY, 20)} minDate={MIN_DATE} maxDate={MAX_DATE} />, </s> remove <DatePicker defaultValue={new Date(2015, 0, 5)} minDate={MIN_DATE} maxDate={MAX_DATE} />, </s> add <DatePicker defaultValue={new Date(2015, Months.JANUARY, 5)} minDate={MIN_DATE} maxDate={MAX_DATE} />, </s> remove const minDate = new Date(2000, 0, 10); </s> add const minDate = new Date(2000, Months.JANUARY, 10);
<DatePicker initialMonth={new Date(2015, Months.JANUARY, 12)} minDate={MIN_DATE} maxDate={MAX_DATE} />,
}); it("an error is not thrown if initialMonth is outside day bounds but inside month bounds", () => { assert.doesNotThrow(() => wrap( <DatePicker initialMonth={new Date(2015, Months.JANUARY, 12)} minDate={MIN_DATE} maxDate={MAX_DATE} />, )); }); it("only days outside bounds have disabled class", () => { const minDate = new Date(2000, 0, 10);
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
expose Months value mapping in datetime package (#439) * expose new `const enum Months` * replace all month numbers with enum values throughout code and tests * fixes #431
https://github.com/palantir/blueprint/commit/ab4f6a8587879913de2e57df0ac87ca51021ccca
packages/datetime/test/datePickerTests.tsx
)); }); it("only days outside bounds have disabled class", () => { const minDate = new Date(2000, 0, 10); const { getDay } = wrap(<DatePicker initialMonth={minDate} minDate={minDate} />); // 8 is before min date, 12 is after assert.isTrue(getDay(8).hasClass(Classes.DATEPICKER_DAY_DISABLED)); assert.isFalse(getDay(12).hasClass(Classes.DATEPICKER_DAY_DISABLED)); });
</s> remove const minDate = new Date(2000, 0, 10); </s> add const minDate = new Date(2000, Months.JANUARY, 10); </s> remove <DatePicker initialMonth={new Date(2015, 0, 12)} minDate={MIN_DATE} maxDate={MAX_DATE} />, </s> add <DatePicker initialMonth={new Date(2015, Months.JANUARY, 12)} minDate={MIN_DATE} maxDate={MAX_DATE} />, </s> remove const minDate = new Date(2000, 0, 10); const maxDate = new Date(2000, 0, 8); </s> add const minDate = new Date(2000, Months.JANUARY, 10); const maxDate = new Date(2000, Months.JANUARY, 8); </s> remove const maxDate = new Date(2005, 0); const minDate = new Date(2000, 0); </s> add const maxDate = new Date(2005, Months.JANUARY); const minDate = new Date(2000, Months.JANUARY); </s> remove const minDate = new Date(2015, 0, 5); const maxDate = new Date(2015, 0, 7); const initialMonth = new Date(2015, 0, 12); </s> add const minDate = new Date(2015, Months.JANUARY, 5); const maxDate = new Date(2015, Months.JANUARY, 7); const initialMonth = new Date(2015, Months.JANUARY, 12);
const minDate = new Date(2000, Months.JANUARY, 10);
)); }); it("only days outside bounds have disabled class", () => { const minDate = new Date(2000, Months.JANUARY, 10); const { getDay } = wrap(<DatePicker initialMonth={minDate} minDate={minDate} />); // 8 is before min date, 12 is after assert.isTrue(getDay(8).hasClass(Classes.DATEPICKER_DAY_DISABLED)); assert.isFalse(getDay(12).hasClass(Classes.DATEPICKER_DAY_DISABLED)); });
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
expose Months value mapping in datetime package (#439) * expose new `const enum Months` * replace all month numbers with enum values throughout code and tests * fixes #431
https://github.com/palantir/blueprint/commit/ab4f6a8587879913de2e57df0ac87ca51021ccca
packages/datetime/test/datePickerTests.tsx
}); describe("when controlled", () => { it("value initially selects a day", () => { const value = new Date(2010, 0, 1); const { getSelectedDays } = wrap( <DatePicker defaultValue={new Date(2010, 1, 2)} value={value} />, ); assert.lengthOf(getSelectedDays(), 1); assert.equal(getSelectedDays().at(0).text(), value.getDate());
</s> remove <DatePicker defaultValue={new Date(2010, 1, 2)} value={value} />, </s> add <DatePicker defaultValue={new Date(2010, Months.FEBRUARY, 2)} value={value} />, </s> remove const defaultValue = [new Date(2010, 1, 2), null] as DateRange; const value = [new Date(2010, 0, 1), null] as DateRange; </s> add const defaultValue = [new Date(2010, Months.FEBRUARY, 2), null] as DateRange; const value = [new Date(2010, Months.JANUARY, 1), null] as DateRange; </s> remove const value = new Date(2010, 0, 2); </s> add const value = new Date(2010, Months.JANUARY, 2); </s> remove const value = new Date(2010, 0, 2); </s> add const value = new Date(2010, Months.JANUARY, 2); </s> remove const value = new Date(2007, 3, 4); </s> add const value = new Date(2007, Months.APRIL, 4);
const value = new Date(2010, Months.JANUARY, 1);
}); describe("when controlled", () => { it("value initially selects a day", () => { const value = new Date(2010, Months.JANUARY, 1); const { getSelectedDays } = wrap( <DatePicker defaultValue={new Date(2010, 1, 2)} value={value} />, ); assert.lengthOf(getSelectedDays(), 1); assert.equal(getSelectedDays().at(0).text(), value.getDate());
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
expose Months value mapping in datetime package (#439) * expose new `const enum Months` * replace all month numbers with enum values throughout code and tests * fixes #431
https://github.com/palantir/blueprint/commit/ab4f6a8587879913de2e57df0ac87ca51021ccca
packages/datetime/test/datePickerTests.tsx
describe("when controlled", () => { it("value initially selects a day", () => { const value = new Date(2010, 0, 1); const { getSelectedDays } = wrap( <DatePicker defaultValue={new Date(2010, 1, 2)} value={value} />, ); assert.lengthOf(getSelectedDays(), 1); assert.equal(getSelectedDays().at(0).text(), value.getDate()); });
</s> remove const value = new Date(2010, 0, 1); </s> add const value = new Date(2010, Months.JANUARY, 1); </s> remove const defaultValue = [new Date(2010, 1, 2), null] as DateRange; const value = [new Date(2010, 0, 1), null] as DateRange; </s> add const defaultValue = [new Date(2010, Months.FEBRUARY, 2), null] as DateRange; const value = [new Date(2010, Months.JANUARY, 1), null] as DateRange; </s> remove const value = new Date(2010, 0, 2); </s> add const value = new Date(2010, Months.JANUARY, 2); </s> remove const value = new Date(2010, 0, 2); </s> add const value = new Date(2010, Months.JANUARY, 2); </s> remove const value = new Date(2007, 3, 4); </s> add const value = new Date(2007, Months.APRIL, 4);
<DatePicker defaultValue={new Date(2010, Months.FEBRUARY, 2)} value={value} />,
describe("when controlled", () => { it("value initially selects a day", () => { const value = new Date(2010, 0, 1); const { getSelectedDays } = wrap( <DatePicker defaultValue={new Date(2010, Months.FEBRUARY, 2)} value={value} />, ); assert.lengthOf(getSelectedDays(), 1); assert.equal(getSelectedDays().at(0).text(), value.getDate()); });
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
expose Months value mapping in datetime package (#439) * expose new `const enum Months` * replace all month numbers with enum values throughout code and tests * fixes #431
https://github.com/palantir/blueprint/commit/ab4f6a8587879913de2e57df0ac87ca51021ccca
packages/datetime/test/datePickerTests.tsx
assert.lengthOf(getSelectedDays(), 0); }); it("selected day doesn't update on current month view change", () => { const value = new Date(2010, 0, 2); const { months, root, getSelectedDays, years } = wrap(<DatePicker value={value} />); root.find(".DayPicker-NavButton--prev").simulate("click"); assert.lengthOf(getSelectedDays(), 1);
</s> remove const value = new Date(2010, 0, 2); </s> add const value = new Date(2010, Months.JANUARY, 2); </s> remove const value = new Date(2010, 0, 1); </s> add const value = new Date(2010, Months.JANUARY, 1); </s> remove <DatePicker defaultValue={new Date(2010, 1, 2)} value={value} />, </s> add <DatePicker defaultValue={new Date(2010, Months.FEBRUARY, 2)} value={value} />, </s> remove const { months, root, years } = wrap(<DatePicker initialMonth={new Date(2015, 2, 2)} />); assert.equal(root.state("displayMonth"), 2); </s> add const { months, root, years } = wrap(<DatePicker initialMonth={new Date(2015, Months.MARCH, 2)} />); assert.equal(root.state("displayMonth"), Months.MARCH); </s> remove const initialMonth = new Date(2015, 6, 1); </s> add const initialMonth = new Date(2015, Months.JULY, 1);
const value = new Date(2010, Months.JANUARY, 2);
assert.lengthOf(getSelectedDays(), 0); }); it("selected day doesn't update on current month view change", () => { const value = new Date(2010, Months.JANUARY, 2); const { months, root, getSelectedDays, years } = wrap(<DatePicker value={value} />); root.find(".DayPicker-NavButton--prev").simulate("click"); assert.lengthOf(getSelectedDays(), 1);
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
expose Months value mapping in datetime package (#439) * expose new `const enum Months` * replace all month numbers with enum values throughout code and tests * fixes #431
https://github.com/palantir/blueprint/commit/ab4f6a8587879913de2e57df0ac87ca51021ccca
packages/datetime/test/datePickerTests.tsx
root.find(".DayPicker-NavButton--prev").simulate("click"); assert.lengthOf(getSelectedDays(), 1); months.simulate("change", { target: { value: 5 } }); assert.lengthOf(getSelectedDays(), 0); years.simulate("change", { target: { value: 2014 } }); assert.lengthOf(getSelectedDays(), 0); });
</s> remove months.simulate("change", { target: { value: 0 } }); </s> add months.simulate("change", { target: { value: Months.JANUARY } }); </s> remove assert.equal(root.state("displayMonth"), 0); </s> add assert.equal(root.state("displayMonth"), Months.JANUARY); </s> remove months.simulate("change", { target: { value: 0 } }); </s> add months.simulate("change", { target: { value: Months.JANUARY } }); </s> remove assert.equal(root.state("displayMonth"), 0); </s> add assert.equal(root.state("displayMonth"), Months.JANUARY); </s> remove months.simulate("change", { target: { value: 5 } }); </s> add months.simulate("change", { target: { value: Months.JUNE } });
months.simulate("change", { target: { value: Months.JUNE } });
root.find(".DayPicker-NavButton--prev").simulate("click"); assert.lengthOf(getSelectedDays(), 1); months.simulate("change", { target: { value: Months.JUNE } }); assert.lengthOf(getSelectedDays(), 0); years.simulate("change", { target: { value: 2014 } }); assert.lengthOf(getSelectedDays(), 0); });
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
expose Months value mapping in datetime package (#439) * expose new `const enum Months` * replace all month numbers with enum values throughout code and tests * fixes #431
https://github.com/palantir/blueprint/commit/ab4f6a8587879913de2e57df0ac87ca51021ccca
packages/datetime/test/datePickerTests.tsx
assert.isTrue(onChange.args[0][1]); }); it("onChange fired when month is changed", () => { const value = new Date(2010, 0, 2); const onChange = sinon.spy(); const { months, root } = wrap(<DatePicker onChange={onChange} value={value} />); root.find(".DayPicker-NavButton--prev").simulate("click"); assert.isTrue(onChange.calledOnce, "expected onChange called");
</s> remove const value = new Date(2010, 0, 2); </s> add const value = new Date(2010, Months.JANUARY, 2); </s> remove months.simulate("change", { target: { value: 5 } }); </s> add months.simulate("change", { target: { value: Months.JUNE } }); </s> remove const initialMonth = new Date(2015, 6, 1); </s> add const initialMonth = new Date(2015, Months.JULY, 1); </s> remove assert.equal(root.state("displayMonth"), 2); </s> add assert.equal(root.state("displayMonth"), Months.MARCH); </s> remove assert.equal(root.state("displayMonth"), 3); </s> add assert.equal(root.state("displayMonth"), Months.APRIL);
const value = new Date(2010, Months.JANUARY, 2);
assert.isTrue(onChange.args[0][1]); }); it("onChange fired when month is changed", () => { const value = new Date(2010, Months.JANUARY, 2); const onChange = sinon.spy(); const { months, root } = wrap(<DatePicker onChange={onChange} value={value} />); root.find(".DayPicker-NavButton--prev").simulate("click"); assert.isTrue(onChange.calledOnce, "expected onChange called");
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
expose Months value mapping in datetime package (#439) * expose new `const enum Months` * replace all month numbers with enum values throughout code and tests * fixes #431
https://github.com/palantir/blueprint/commit/ab4f6a8587879913de2e57df0ac87ca51021ccca
packages/datetime/test/datePickerTests.tsx
root.find(".DayPicker-NavButton--prev").simulate("click"); assert.isTrue(onChange.calledOnce, "expected onChange called"); assert.isFalse(onChange.firstCall.args[1], "expected hasUserManuallySelectedDate to be false"); months.simulate("change", { target: { value: 5 } }); assert.isTrue(onChange.calledTwice, "expected onChange called again"); assert.isFalse(onChange.secondCall.args[1], "expected hasUserManuallySelectedDate to be false again"); }); it("can change displayed date with the dropdowns in the caption", () => {
</s> remove const { months, root, years } = wrap(<DatePicker initialMonth={new Date(2015, 2, 2)} value={null} />); assert.equal(root.state("displayMonth"), 2); </s> add const { months, root, years } = wrap( <DatePicker initialMonth={new Date(2015, Months.MARCH, 2)} value={null} />); assert.equal(root.state("displayMonth"), Months.MARCH); </s> remove const value = new Date(2010, 0, 2); </s> add const value = new Date(2010, Months.JANUARY, 2); </s> remove const { months, root, years } = wrap(<DatePicker initialMonth={new Date(2015, 2, 2)} />); assert.equal(root.state("displayMonth"), 2); </s> add const { months, root, years } = wrap(<DatePicker initialMonth={new Date(2015, Months.MARCH, 2)} />); assert.equal(root.state("displayMonth"), Months.MARCH); </s> remove renderDateRangePicker({ initialMonth: new Date(2015, 2, 2), value: [null, null] }); assert.equal(dateRangePicker.state.displayMonth, 2); </s> add renderDateRangePicker({ initialMonth: new Date(2015, Months.MARCH, 2), value: [null, null] }); assert.equal(dateRangePicker.state.displayMonth, Months.MARCH); </s> remove months.simulate("change", { target: { value: 5 } }); </s> add months.simulate("change", { target: { value: Months.JUNE } });
months.simulate("change", { target: { value: Months.JUNE } });
root.find(".DayPicker-NavButton--prev").simulate("click"); assert.isTrue(onChange.calledOnce, "expected onChange called"); assert.isFalse(onChange.firstCall.args[1], "expected hasUserManuallySelectedDate to be false"); months.simulate("change", { target: { value: Months.JUNE } }); assert.isTrue(onChange.calledTwice, "expected onChange called again"); assert.isFalse(onChange.secondCall.args[1], "expected hasUserManuallySelectedDate to be false again"); }); it("can change displayed date with the dropdowns in the caption", () => {
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
expose Months value mapping in datetime package (#439) * expose new `const enum Months` * replace all month numbers with enum values throughout code and tests * fixes #431
https://github.com/palantir/blueprint/commit/ab4f6a8587879913de2e57df0ac87ca51021ccca
packages/datetime/test/datePickerTests.tsx
assert.isFalse(onChange.secondCall.args[1], "expected hasUserManuallySelectedDate to be false again"); }); it("can change displayed date with the dropdowns in the caption", () => { const { months, root, years } = wrap(<DatePicker initialMonth={new Date(2015, 2, 2)} value={null} />); assert.equal(root.state("displayMonth"), 2); assert.equal(root.state("displayYear"), 2015); months.simulate("change", { target: { value: 0 } }); years.simulate("change", { target: { value: 2014 } }); assert.equal(root.state("displayMonth"), 0);
</s> remove const { months, root, years } = wrap(<DatePicker initialMonth={new Date(2015, 2, 2)} />); assert.equal(root.state("displayMonth"), 2); </s> add const { months, root, years } = wrap(<DatePicker initialMonth={new Date(2015, Months.MARCH, 2)} />); assert.equal(root.state("displayMonth"), Months.MARCH); </s> remove months.simulate("change", { target: { value: 5 } }); </s> add months.simulate("change", { target: { value: Months.JUNE } }); </s> remove months.simulate("change", { target: { value: 0 } }); </s> add months.simulate("change", { target: { value: Months.JANUARY } }); </s> remove months.simulate("change", { target: { value: 0 } }); </s> add months.simulate("change", { target: { value: Months.JANUARY } }); </s> remove renderDateRangePicker({ initialMonth: new Date(2015, 2, 2), value: [null, null] }); assert.equal(dateRangePicker.state.displayMonth, 2); </s> add renderDateRangePicker({ initialMonth: new Date(2015, Months.MARCH, 2), value: [null, null] }); assert.equal(dateRangePicker.state.displayMonth, Months.MARCH);
const { months, root, years } = wrap( <DatePicker initialMonth={new Date(2015, Months.MARCH, 2)} value={null} />); assert.equal(root.state("displayMonth"), Months.MARCH);
assert.isFalse(onChange.secondCall.args[1], "expected hasUserManuallySelectedDate to be false again"); }); it("can change displayed date with the dropdowns in the caption", () => { const { months, root, years } = wrap( <DatePicker initialMonth={new Date(2015, Months.MARCH, 2)} value={null} />); assert.equal(root.state("displayMonth"), Months.MARCH); const { months, root, years } = wrap( <DatePicker initialMonth={new Date(2015, Months.MARCH, 2)} value={null} />); assert.equal(root.state("displayMonth"), Months.MARCH); assert.equal(root.state("displayYear"), 2015); months.simulate("change", { target: { value: 0 } }); years.simulate("change", { target: { value: 2014 } }); assert.equal(root.state("displayMonth"), 0);
[ "keep", "keep", "keep", "keep", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
expose Months value mapping in datetime package (#439) * expose new `const enum Months` * replace all month numbers with enum values throughout code and tests * fixes #431
https://github.com/palantir/blueprint/commit/ab4f6a8587879913de2e57df0ac87ca51021ccca
packages/datetime/test/datePickerTests.tsx
const { months, root, years } = wrap(<DatePicker initialMonth={new Date(2015, 2, 2)} value={null} />); assert.equal(root.state("displayMonth"), 2); assert.equal(root.state("displayYear"), 2015); months.simulate("change", { target: { value: 0 } }); years.simulate("change", { target: { value: 2014 } }); assert.equal(root.state("displayMonth"), 0); assert.equal(root.state("displayYear"), 2014); }); });
</s> remove months.simulate("change", { target: { value: 0 } }); </s> add months.simulate("change", { target: { value: Months.JANUARY } }); </s> remove const { months, root, years } = wrap(<DatePicker initialMonth={new Date(2015, 2, 2)} value={null} />); assert.equal(root.state("displayMonth"), 2); </s> add const { months, root, years } = wrap( <DatePicker initialMonth={new Date(2015, Months.MARCH, 2)} value={null} />); assert.equal(root.state("displayMonth"), Months.MARCH); </s> remove const { months, root, years } = wrap(<DatePicker initialMonth={new Date(2015, 2, 2)} />); assert.equal(root.state("displayMonth"), 2); </s> add const { months, root, years } = wrap(<DatePicker initialMonth={new Date(2015, Months.MARCH, 2)} />); assert.equal(root.state("displayMonth"), Months.MARCH); </s> remove assert.equal(root.state("displayMonth"), 0); </s> add assert.equal(root.state("displayMonth"), Months.JANUARY); </s> remove assert.equal(root.state("displayMonth"), 0); </s> add assert.equal(root.state("displayMonth"), Months.JANUARY);
months.simulate("change", { target: { value: Months.JANUARY } });
const { months, root, years } = wrap(<DatePicker initialMonth={new Date(2015, 2, 2)} value={null} />); assert.equal(root.state("displayMonth"), 2); assert.equal(root.state("displayYear"), 2015); months.simulate("change", { target: { value: Months.JANUARY } }); years.simulate("change", { target: { value: 2014 } }); assert.equal(root.state("displayMonth"), 0); assert.equal(root.state("displayYear"), 2014); }); });
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
expose Months value mapping in datetime package (#439) * expose new `const enum Months` * replace all month numbers with enum values throughout code and tests * fixes #431
https://github.com/palantir/blueprint/commit/ab4f6a8587879913de2e57df0ac87ca51021ccca
packages/datetime/test/datePickerTests.tsx
assert.equal(root.state("displayYear"), 2015); months.simulate("change", { target: { value: 0 } }); years.simulate("change", { target: { value: 2014 } }); assert.equal(root.state("displayMonth"), 0); assert.equal(root.state("displayYear"), 2014); }); }); describe("when uncontrolled", () => {
</s> remove assert.equal(root.state("displayMonth"), 0); </s> add assert.equal(root.state("displayMonth"), Months.JANUARY); </s> remove months.simulate("change", { target: { value: 0 } }); </s> add months.simulate("change", { target: { value: Months.JANUARY } }); </s> remove months.simulate("change", { target: { value: 0 } }); </s> add months.simulate("change", { target: { value: Months.JANUARY } }); </s> remove const { months, root, years } = wrap(<DatePicker initialMonth={new Date(2015, 2, 2)} />); assert.equal(root.state("displayMonth"), 2); </s> add const { months, root, years } = wrap(<DatePicker initialMonth={new Date(2015, Months.MARCH, 2)} />); assert.equal(root.state("displayMonth"), Months.MARCH); </s> remove const { months, root, years } = wrap(<DatePicker initialMonth={new Date(2015, 2, 2)} value={null} />); assert.equal(root.state("displayMonth"), 2); </s> add const { months, root, years } = wrap( <DatePicker initialMonth={new Date(2015, Months.MARCH, 2)} value={null} />); assert.equal(root.state("displayMonth"), Months.MARCH);
assert.equal(root.state("displayMonth"), Months.JANUARY);
assert.equal(root.state("displayYear"), 2015); months.simulate("change", { target: { value: 0 } }); years.simulate("change", { target: { value: 2014 } }); assert.equal(root.state("displayMonth"), Months.JANUARY); assert.equal(root.state("displayYear"), 2014); }); }); describe("when uncontrolled", () => {
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
expose Months value mapping in datetime package (#439) * expose new `const enum Months` * replace all month numbers with enum values throughout code and tests * fixes #431
https://github.com/palantir/blueprint/commit/ab4f6a8587879913de2e57df0ac87ca51021ccca
packages/datetime/test/datePickerTests.tsx
assert.deepEqual(getSelectedDays().map((d) => d.text()), ["3"]); }); it("selected day is preserved when selections are changed", () => { const initialMonth = new Date(2015, 6, 1); const { getDay, getSelectedDays, months } = wrap(<DatePicker initialMonth={initialMonth} />); getDay(31).simulate("click"); months.simulate("change", { target: { value: 7 } }); assert.deepEqual(getSelectedDays().map((d) => d.text()), ["31"]); });
</s> remove months.simulate("change", { target: { value: 7 } }); </s> add months.simulate("change", { target: { value: Months.AUGUST } }); </s> remove const initialMonth = new Date(2015, 6, 1); </s> add const initialMonth = new Date(2015, Months.JULY, 1); </s> remove const initialMonth = new Date(2015, 6, 1); const minDate = new Date(2015, 2, 13); const maxDate = new Date(2015, 10, 21); </s> add const initialMonth = new Date(2015, Months.JULY, 1); const minDate = new Date(2015, Months.MARCH, 13); const maxDate = new Date(2015, Months.NOVEMBER, 21); </s> remove const value = new Date(2010, 0, 2); </s> add const value = new Date(2010, Months.JANUARY, 2); </s> remove const { months, root, years } = wrap(<DatePicker initialMonth={new Date(2015, 2, 2)} />); assert.equal(root.state("displayMonth"), 2); </s> add const { months, root, years } = wrap(<DatePicker initialMonth={new Date(2015, Months.MARCH, 2)} />); assert.equal(root.state("displayMonth"), Months.MARCH);
const initialMonth = new Date(2015, Months.JULY, 1);
assert.deepEqual(getSelectedDays().map((d) => d.text()), ["3"]); }); it("selected day is preserved when selections are changed", () => { const initialMonth = new Date(2015, Months.JULY, 1); const { getDay, getSelectedDays, months } = wrap(<DatePicker initialMonth={initialMonth} />); getDay(31).simulate("click"); months.simulate("change", { target: { value: 7 } }); assert.deepEqual(getSelectedDays().map((d) => d.text()), ["31"]); });
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
expose Months value mapping in datetime package (#439) * expose new `const enum Months` * replace all month numbers with enum values throughout code and tests * fixes #431
https://github.com/palantir/blueprint/commit/ab4f6a8587879913de2e57df0ac87ca51021ccca
packages/datetime/test/datePickerTests.tsx
it("selected day is preserved when selections are changed", () => { const initialMonth = new Date(2015, 6, 1); const { getDay, getSelectedDays, months } = wrap(<DatePicker initialMonth={initialMonth} />); getDay(31).simulate("click"); months.simulate("change", { target: { value: 7 } }); assert.deepEqual(getSelectedDays().map((d) => d.text()), ["31"]); }); it("selected day is changed if necessary when selections are changed", () => { const initialMonth = new Date(2015, 6, 1);
</s> remove const initialMonth = new Date(2015, 6, 1); </s> add const initialMonth = new Date(2015, Months.JULY, 1); </s> remove const initialMonth = new Date(2015, 6, 1); </s> add const initialMonth = new Date(2015, Months.JULY, 1); </s> remove const initialMonth = new Date(2015, 6, 1); const minDate = new Date(2015, 2, 13); const maxDate = new Date(2015, 10, 21); </s> add const initialMonth = new Date(2015, Months.JULY, 1); const minDate = new Date(2015, Months.MARCH, 13); const maxDate = new Date(2015, Months.NOVEMBER, 21); </s> remove const value = new Date(2010, 0, 2); </s> add const value = new Date(2010, Months.JANUARY, 2); </s> remove const value = new Date(2010, 0, 2); </s> add const value = new Date(2010, Months.JANUARY, 2);
months.simulate("change", { target: { value: Months.AUGUST } });
it("selected day is preserved when selections are changed", () => { const initialMonth = new Date(2015, 6, 1); const { getDay, getSelectedDays, months } = wrap(<DatePicker initialMonth={initialMonth} />); getDay(31).simulate("click"); months.simulate("change", { target: { value: Months.AUGUST } }); assert.deepEqual(getSelectedDays().map((d) => d.text()), ["31"]); }); it("selected day is changed if necessary when selections are changed", () => { const initialMonth = new Date(2015, 6, 1);
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
expose Months value mapping in datetime package (#439) * expose new `const enum Months` * replace all month numbers with enum values throughout code and tests * fixes #431
https://github.com/palantir/blueprint/commit/ab4f6a8587879913de2e57df0ac87ca51021ccca
packages/datetime/test/datePickerTests.tsx
assert.deepEqual(getSelectedDays().map((d) => d.text()), ["31"]); }); it("selected day is changed if necessary when selections are changed", () => { const initialMonth = new Date(2015, 6, 1); const { getDay, getSelectedDays, root } = wrap(<DatePicker initialMonth={initialMonth} />); getDay(31).simulate("click"); root.find(".DayPicker-NavButton--prev").simulate("click"); assert.deepEqual(getSelectedDays().map((d) => d.text()), ["30"]); });
</s> remove months.simulate("change", { target: { value: 7 } }); </s> add months.simulate("change", { target: { value: Months.AUGUST } }); </s> remove const initialMonth = new Date(2015, 6, 1); </s> add const initialMonth = new Date(2015, Months.JULY, 1); </s> remove const initialMonth = new Date(2015, 6, 1); const minDate = new Date(2015, 2, 13); const maxDate = new Date(2015, 10, 21); </s> add const initialMonth = new Date(2015, Months.JULY, 1); const minDate = new Date(2015, Months.MARCH, 13); const maxDate = new Date(2015, Months.NOVEMBER, 21); </s> remove const value = new Date(2010, 0, 2); </s> add const value = new Date(2010, Months.JANUARY, 2); </s> remove const value = new Date(2010, 0, 2); </s> add const value = new Date(2010, Months.JANUARY, 2);
const initialMonth = new Date(2015, Months.JULY, 1);
assert.deepEqual(getSelectedDays().map((d) => d.text()), ["31"]); }); it("selected day is changed if necessary when selections are changed", () => { const initialMonth = new Date(2015, Months.JULY, 1); const { getDay, getSelectedDays, root } = wrap(<DatePicker initialMonth={initialMonth} />); getDay(31).simulate("click"); root.find(".DayPicker-NavButton--prev").simulate("click"); assert.deepEqual(getSelectedDays().map((d) => d.text()), ["30"]); });
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
expose Months value mapping in datetime package (#439) * expose new `const enum Months` * replace all month numbers with enum values throughout code and tests * fixes #431
https://github.com/palantir/blueprint/commit/ab4f6a8587879913de2e57df0ac87ca51021ccca
packages/datetime/test/datePickerTests.tsx
assert.deepEqual(getSelectedDays().map((d) => d.text()), ["30"]); }); it("selected day is changed to minDate or maxDate if selections are changed outside bounds", () => { const initialMonth = new Date(2015, 6, 1); const minDate = new Date(2015, 2, 13); const maxDate = new Date(2015, 10, 21); const { getDay, getSelectedDays, months } = wrap( <DatePicker initialMonth={initialMonth} minDate={minDate} maxDate={maxDate} />, ); getDay(1).simulate("click");
</s> remove const initialMonth = new Date(2015, 6, 1); </s> add const initialMonth = new Date(2015, Months.JULY, 1); </s> remove months.simulate("change", { target: { value: 7 } }); </s> add months.simulate("change", { target: { value: Months.AUGUST } }); </s> remove const initialMonth = new Date(2015, 6, 1); </s> add const initialMonth = new Date(2015, Months.JULY, 1); </s> remove const maxDate = new Date(2005, 0); const minDate = new Date(2000, 0); </s> add const maxDate = new Date(2005, Months.JANUARY); const minDate = new Date(2000, Months.JANUARY); </s> remove const minDate = new Date(2015, 0, 5); const maxDate = new Date(2015, 0, 7); const initialMonth = new Date(2015, 0, 12); </s> add const minDate = new Date(2015, Months.JANUARY, 5); const maxDate = new Date(2015, Months.JANUARY, 7); const initialMonth = new Date(2015, Months.JANUARY, 12);
const initialMonth = new Date(2015, Months.JULY, 1); const minDate = new Date(2015, Months.MARCH, 13); const maxDate = new Date(2015, Months.NOVEMBER, 21);
assert.deepEqual(getSelectedDays().map((d) => d.text()), ["30"]); }); it("selected day is changed to minDate or maxDate if selections are changed outside bounds", () => { const initialMonth = new Date(2015, Months.JULY, 1); const minDate = new Date(2015, Months.MARCH, 13); const maxDate = new Date(2015, Months.NOVEMBER, 21); const initialMonth = new Date(2015, Months.JULY, 1); const minDate = new Date(2015, Months.MARCH, 13); const maxDate = new Date(2015, Months.NOVEMBER, 21); const initialMonth = new Date(2015, Months.JULY, 1); const minDate = new Date(2015, Months.MARCH, 13); const maxDate = new Date(2015, Months.NOVEMBER, 21); const { getDay, getSelectedDays, months } = wrap( <DatePicker initialMonth={initialMonth} minDate={minDate} maxDate={maxDate} />, ); getDay(1).simulate("click");
[ "keep", "keep", "keep", "keep", "replace", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
expose Months value mapping in datetime package (#439) * expose new `const enum Months` * replace all month numbers with enum values throughout code and tests * fixes #431
https://github.com/palantir/blueprint/commit/ab4f6a8587879913de2e57df0ac87ca51021ccca
packages/datetime/test/datePickerTests.tsx
<DatePicker initialMonth={initialMonth} minDate={minDate} maxDate={maxDate} />, ); getDay(1).simulate("click"); months.simulate("change", { target: { value: 2 } }); let selectedDayElements = getSelectedDays(); assert.lengthOf(selectedDayElements, 1); assert.equal(selectedDayElements.at(0).text(), minDate.getDate()); getDay(25).simulate("click");
</s> remove months.simulate("change", { target: { value: 10 } }); </s> add months.simulate("change", { target: { value: Months.NOVEMBER } }); </s> remove const initialMonth = new Date(2015, 6, 1); const minDate = new Date(2015, 2, 13); const maxDate = new Date(2015, 10, 21); </s> add const initialMonth = new Date(2015, Months.JULY, 1); const minDate = new Date(2015, Months.MARCH, 13); const maxDate = new Date(2015, Months.NOVEMBER, 21); </s> remove months.simulate("change", { target: { value: 7 } }); </s> add months.simulate("change", { target: { value: Months.AUGUST } }); </s> remove months.simulate("change", { target: { value: 5 } }); </s> add months.simulate("change", { target: { value: Months.JUNE } }); </s> remove const { months, root, years } = wrap(<DatePicker initialMonth={new Date(2015, 2, 2)} />); assert.equal(root.state("displayMonth"), 2); </s> add const { months, root, years } = wrap(<DatePicker initialMonth={new Date(2015, Months.MARCH, 2)} />); assert.equal(root.state("displayMonth"), Months.MARCH);
months.simulate("change", { target: { value: Months.MARCH } });
<DatePicker initialMonth={initialMonth} minDate={minDate} maxDate={maxDate} />, ); getDay(1).simulate("click"); months.simulate("change", { target: { value: Months.MARCH } }); let selectedDayElements = getSelectedDays(); assert.lengthOf(selectedDayElements, 1); assert.equal(selectedDayElements.at(0).text(), minDate.getDate()); getDay(25).simulate("click");
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
expose Months value mapping in datetime package (#439) * expose new `const enum Months` * replace all month numbers with enum values throughout code and tests * fixes #431
https://github.com/palantir/blueprint/commit/ab4f6a8587879913de2e57df0ac87ca51021ccca
packages/datetime/test/datePickerTests.tsx
assert.lengthOf(selectedDayElements, 1); assert.equal(selectedDayElements.at(0).text(), minDate.getDate()); getDay(25).simulate("click"); months.simulate("change", { target: { value: 10 } }); selectedDayElements = getSelectedDays(); assert.lengthOf(selectedDayElements, 1); assert.equal(selectedDayElements.at(0).text(), maxDate.getDate()); });
</s> remove months.simulate("change", { target: { value: 2 } }); </s> add months.simulate("change", { target: { value: Months.MARCH } }); </s> remove const { months, root, years } = wrap(<DatePicker initialMonth={new Date(2015, 2, 2)} />); assert.equal(root.state("displayMonth"), 2); </s> add const { months, root, years } = wrap(<DatePicker initialMonth={new Date(2015, Months.MARCH, 2)} />); assert.equal(root.state("displayMonth"), Months.MARCH); </s> remove months.simulate("change", { target: { value: 5 } }); </s> add months.simulate("change", { target: { value: Months.JUNE } }); </s> remove months.simulate("change", { target: { value: 0 } }); </s> add months.simulate("change", { target: { value: Months.JANUARY } }); </s> remove months.simulate("change", { target: { value: 0 } }); </s> add months.simulate("change", { target: { value: Months.JANUARY } });
months.simulate("change", { target: { value: Months.NOVEMBER } });
assert.lengthOf(selectedDayElements, 1); assert.equal(selectedDayElements.at(0).text(), minDate.getDate()); getDay(25).simulate("click"); months.simulate("change", { target: { value: Months.NOVEMBER } }); selectedDayElements = getSelectedDays(); assert.lengthOf(selectedDayElements, 1); assert.equal(selectedDayElements.at(0).text(), maxDate.getDate()); });
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
expose Months value mapping in datetime package (#439) * expose new `const enum Months` * replace all month numbers with enum values throughout code and tests * fixes #431
https://github.com/palantir/blueprint/commit/ab4f6a8587879913de2e57df0ac87ca51021ccca
packages/datetime/test/datePickerTests.tsx
assert.equal(selectedDayElements.at(0).text(), maxDate.getDate()); }); it("can change displayed date with the dropdowns in the caption", () => { const { months, root, years } = wrap(<DatePicker initialMonth={new Date(2015, 2, 2)} />); assert.equal(root.state("displayMonth"), 2); assert.equal(root.state("displayYear"), 2015); months.simulate("change", { target: { value: 0 } }); years.simulate("change", { target: { value: 2014 } }); assert.equal(root.state("displayMonth"), 0);
</s> remove const { months, root, years } = wrap(<DatePicker initialMonth={new Date(2015, 2, 2)} value={null} />); assert.equal(root.state("displayMonth"), 2); </s> add const { months, root, years } = wrap( <DatePicker initialMonth={new Date(2015, Months.MARCH, 2)} value={null} />); assert.equal(root.state("displayMonth"), Months.MARCH); </s> remove months.simulate("change", { target: { value: 0 } }); </s> add months.simulate("change", { target: { value: Months.JANUARY } }); </s> remove months.simulate("change", { target: { value: 0 } }); </s> add months.simulate("change", { target: { value: Months.JANUARY } }); </s> remove renderDateRangePicker({ initialMonth: new Date(2015, 2, 2), value: [null, null] }); assert.equal(dateRangePicker.state.displayMonth, 2); </s> add renderDateRangePicker({ initialMonth: new Date(2015, Months.MARCH, 2), value: [null, null] }); assert.equal(dateRangePicker.state.displayMonth, Months.MARCH); </s> remove months.simulate("change", { target: { value: 5 } }); </s> add months.simulate("change", { target: { value: Months.JUNE } });
const { months, root, years } = wrap(<DatePicker initialMonth={new Date(2015, Months.MARCH, 2)} />); assert.equal(root.state("displayMonth"), Months.MARCH);
assert.equal(selectedDayElements.at(0).text(), maxDate.getDate()); }); it("can change displayed date with the dropdowns in the caption", () => { const { months, root, years } = wrap(<DatePicker initialMonth={new Date(2015, Months.MARCH, 2)} />); assert.equal(root.state("displayMonth"), Months.MARCH); const { months, root, years } = wrap(<DatePicker initialMonth={new Date(2015, Months.MARCH, 2)} />); assert.equal(root.state("displayMonth"), Months.MARCH); assert.equal(root.state("displayYear"), 2015); months.simulate("change", { target: { value: 0 } }); years.simulate("change", { target: { value: 2014 } }); assert.equal(root.state("displayMonth"), 0);
[ "keep", "keep", "keep", "keep", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
expose Months value mapping in datetime package (#439) * expose new `const enum Months` * replace all month numbers with enum values throughout code and tests * fixes #431
https://github.com/palantir/blueprint/commit/ab4f6a8587879913de2e57df0ac87ca51021ccca
packages/datetime/test/datePickerTests.tsx
const { months, root, years } = wrap(<DatePicker initialMonth={new Date(2015, 2, 2)} />); assert.equal(root.state("displayMonth"), 2); assert.equal(root.state("displayYear"), 2015); months.simulate("change", { target: { value: 0 } }); years.simulate("change", { target: { value: 2014 } }); assert.equal(root.state("displayMonth"), 0); assert.equal(root.state("displayYear"), 2014); }); });
</s> remove months.simulate("change", { target: { value: 0 } }); </s> add months.simulate("change", { target: { value: Months.JANUARY } }); </s> remove const { months, root, years } = wrap(<DatePicker initialMonth={new Date(2015, 2, 2)} />); assert.equal(root.state("displayMonth"), 2); </s> add const { months, root, years } = wrap(<DatePicker initialMonth={new Date(2015, Months.MARCH, 2)} />); assert.equal(root.state("displayMonth"), Months.MARCH); </s> remove const { months, root, years } = wrap(<DatePicker initialMonth={new Date(2015, 2, 2)} value={null} />); assert.equal(root.state("displayMonth"), 2); </s> add const { months, root, years } = wrap( <DatePicker initialMonth={new Date(2015, Months.MARCH, 2)} value={null} />); assert.equal(root.state("displayMonth"), Months.MARCH); </s> remove assert.equal(root.state("displayMonth"), 0); </s> add assert.equal(root.state("displayMonth"), Months.JANUARY); </s> remove assert.equal(root.state("displayMonth"), 0); </s> add assert.equal(root.state("displayMonth"), Months.JANUARY);
months.simulate("change", { target: { value: Months.JANUARY } });
const { months, root, years } = wrap(<DatePicker initialMonth={new Date(2015, 2, 2)} />); assert.equal(root.state("displayMonth"), 2); assert.equal(root.state("displayYear"), 2015); months.simulate("change", { target: { value: Months.JANUARY } }); years.simulate("change", { target: { value: 2014 } }); assert.equal(root.state("displayMonth"), 0); assert.equal(root.state("displayYear"), 2014); }); });
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
expose Months value mapping in datetime package (#439) * expose new `const enum Months` * replace all month numbers with enum values throughout code and tests * fixes #431
https://github.com/palantir/blueprint/commit/ab4f6a8587879913de2e57df0ac87ca51021ccca
packages/datetime/test/datePickerTests.tsx
assert.equal(root.state("displayYear"), 2015); months.simulate("change", { target: { value: 0 } }); years.simulate("change", { target: { value: 2014 } }); assert.equal(root.state("displayMonth"), 0); assert.equal(root.state("displayYear"), 2014); }); }); it("onChange correctly passes a Date and never null when canClearSelection is false", () => {
</s> remove assert.equal(root.state("displayMonth"), 0); </s> add assert.equal(root.state("displayMonth"), Months.JANUARY); </s> remove months.simulate("change", { target: { value: 0 } }); </s> add months.simulate("change", { target: { value: Months.JANUARY } }); </s> remove months.simulate("change", { target: { value: 0 } }); </s> add months.simulate("change", { target: { value: Months.JANUARY } }); </s> remove const { months, root, years } = wrap(<DatePicker initialMonth={new Date(2015, 2, 2)} />); assert.equal(root.state("displayMonth"), 2); </s> add const { months, root, years } = wrap(<DatePicker initialMonth={new Date(2015, Months.MARCH, 2)} />); assert.equal(root.state("displayMonth"), Months.MARCH); </s> remove const { months, root, years } = wrap(<DatePicker initialMonth={new Date(2015, 2, 2)} value={null} />); assert.equal(root.state("displayMonth"), 2); </s> add const { months, root, years } = wrap( <DatePicker initialMonth={new Date(2015, Months.MARCH, 2)} value={null} />); assert.equal(root.state("displayMonth"), Months.MARCH);
assert.equal(root.state("displayMonth"), Months.JANUARY);
assert.equal(root.state("displayYear"), 2015); months.simulate("change", { target: { value: 0 } }); years.simulate("change", { target: { value: 2014 } }); assert.equal(root.state("displayMonth"), Months.JANUARY); assert.equal(root.state("displayYear"), 2014); }); }); it("onChange correctly passes a Date and never null when canClearSelection is false", () => {
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
expose Months value mapping in datetime package (#439) * expose new `const enum Months` * replace all month numbers with enum values throughout code and tests * fixes #431
https://github.com/palantir/blueprint/commit/ab4f6a8587879913de2e57df0ac87ca51021ccca
packages/datetime/test/datePickerTests.tsx
import * as DateUtils from "../src/common/dateUtils"; import * as Errors from "../src/common/errors"; import { Classes as DateClasses, DateRange, DateRangePicker, IDateRangePickerProps } from "../src/index"; describe("<DateRangePicker>", () => { let testsContainerElement: Element;
</s> remove const defaultValue = [new Date(2010, 1, 2), null] as DateRange; const value = [new Date(2010, 0, 1), null] as DateRange; </s> add const defaultValue = [new Date(2010, Months.FEBRUARY, 2), null] as DateRange; const value = [new Date(2010, Months.JANUARY, 1), null] as DateRange;
import { Months } from "../src/common/months";
import * as DateUtils from "../src/common/dateUtils"; import * as Errors from "../src/common/errors"; import { Months } from "../src/common/months"; import { Classes as DateClasses, DateRange, DateRangePicker, IDateRangePickerProps } from "../src/index"; describe("<DateRangePicker>", () => { let testsContainerElement: Element;
[ "keep", "keep", "add", "keep", "keep", "keep", "keep" ]
expose Months value mapping in datetime package (#439) * expose new `const enum Months` * replace all month numbers with enum values throughout code and tests * fixes #431
https://github.com/palantir/blueprint/commit/ab4f6a8587879913de2e57df0ac87ca51021ccca
packages/datetime/test/dateRangePickerTests.tsx
}); describe("initially displayed month", () => { it("is initialMonth if set", () => { const defaultValue = [new Date(2007, 3, 4), null] as DateRange; const initialMonth = new Date(2002, 2, 1); const maxDate = new Date(2020, 0); const minDate = new Date(2000, 0); renderDateRangePicker({ defaultValue, initialMonth, maxDate, minDate }); assert.equal(dateRangePicker.state.displayYear, 2002); assert.equal(dateRangePicker.state.displayMonth, 2); });
</s> remove assert.equal(dateRangePicker.state.displayMonth, 2); </s> add assert.equal(dateRangePicker.state.displayMonth, Months.MARCH); </s> remove const defaultValue = [new Date(2007, 3, 4), null] as DateRange; const maxDate = new Date(2020, 0); const minDate = new Date(2000, 0); </s> add const defaultValue = [new Date(2007, Months.APRIL, 4), null] as DateRange; const maxDate = new Date(2020, Months.JANUARY); const minDate = new Date(2000, Months.JANUARY); </s> remove const maxDate = new Date(2020, 0); const minDate = new Date(2000, 0); const value = [new Date(2007, 3, 4), null] as DateRange; </s> add const maxDate = new Date(2020, Months.JANUARY); const minDate = new Date(2000, Months.JANUARY); const value = [new Date(2007, Months.APRIL, 4), null] as DateRange; </s> remove assert.equal(dateRangePicker.state.displayMonth, 3); </s> add assert.equal(dateRangePicker.state.displayMonth, Months.APRIL); </s> remove assert.equal(dateRangePicker.state.displayMonth, 3); </s> add assert.equal(dateRangePicker.state.displayMonth, Months.APRIL);
const defaultValue = [new Date(2007, Months.APRIL, 4), null] as DateRange; const initialMonth = new Date(2002, Months.MARCH, 1); const maxDate = new Date(2020, Months.JANUARY); const minDate = new Date(2000, Months.JANUARY);
}); describe("initially displayed month", () => { it("is initialMonth if set", () => { const defaultValue = [new Date(2007, Months.APRIL, 4), null] as DateRange; const initialMonth = new Date(2002, Months.MARCH, 1); const maxDate = new Date(2020, Months.JANUARY); const minDate = new Date(2000, Months.JANUARY); const defaultValue = [new Date(2007, Months.APRIL, 4), null] as DateRange; const initialMonth = new Date(2002, Months.MARCH, 1); const maxDate = new Date(2020, Months.JANUARY); const minDate = new Date(2000, Months.JANUARY); const defaultValue = [new Date(2007, Months.APRIL, 4), null] as DateRange; const initialMonth = new Date(2002, Months.MARCH, 1); const maxDate = new Date(2020, Months.JANUARY); const minDate = new Date(2000, Months.JANUARY); const defaultValue = [new Date(2007, Months.APRIL, 4), null] as DateRange; const initialMonth = new Date(2002, Months.MARCH, 1); const maxDate = new Date(2020, Months.JANUARY); const minDate = new Date(2000, Months.JANUARY); renderDateRangePicker({ defaultValue, initialMonth, maxDate, minDate }); assert.equal(dateRangePicker.state.displayYear, 2002); assert.equal(dateRangePicker.state.displayMonth, 2); });
[ "keep", "keep", "keep", "keep", "replace", "replace", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
expose Months value mapping in datetime package (#439) * expose new `const enum Months` * replace all month numbers with enum values throughout code and tests * fixes #431
https://github.com/palantir/blueprint/commit/ab4f6a8587879913de2e57df0ac87ca51021ccca
packages/datetime/test/dateRangePickerTests.tsx
const maxDate = new Date(2020, 0); const minDate = new Date(2000, 0); renderDateRangePicker({ defaultValue, initialMonth, maxDate, minDate }); assert.equal(dateRangePicker.state.displayYear, 2002); assert.equal(dateRangePicker.state.displayMonth, 2); }); it("is defaultValue if set and initialMonth not set", () => { const defaultValue = [new Date(2007, 3, 4), null] as DateRange; const maxDate = new Date(2020, 0);
</s> remove const defaultValue = [new Date(2007, 3, 4), null] as DateRange; const maxDate = new Date(2020, 0); const minDate = new Date(2000, 0); </s> add const defaultValue = [new Date(2007, Months.APRIL, 4), null] as DateRange; const maxDate = new Date(2020, Months.JANUARY); const minDate = new Date(2000, Months.JANUARY); </s> remove const defaultValue = [new Date(2007, 3, 4), null] as DateRange; const initialMonth = new Date(2002, 2, 1); const maxDate = new Date(2020, 0); const minDate = new Date(2000, 0); </s> add const defaultValue = [new Date(2007, Months.APRIL, 4), null] as DateRange; const initialMonth = new Date(2002, Months.MARCH, 1); const maxDate = new Date(2020, Months.JANUARY); const minDate = new Date(2000, Months.JANUARY); </s> remove const maxDate = new Date(2020, 0); const minDate = new Date(2000, 0); const value = [new Date(2007, 3, 4), null] as DateRange; </s> add const maxDate = new Date(2020, Months.JANUARY); const minDate = new Date(2000, Months.JANUARY); const value = [new Date(2007, Months.APRIL, 4), null] as DateRange; </s> remove assert.equal(dateRangePicker.state.displayMonth, 3); </s> add assert.equal(dateRangePicker.state.displayMonth, Months.APRIL); </s> remove assert.equal(dateRangePicker.state.displayMonth, 3); </s> add assert.equal(dateRangePicker.state.displayMonth, Months.APRIL);
assert.equal(dateRangePicker.state.displayMonth, Months.MARCH);
const maxDate = new Date(2020, 0); const minDate = new Date(2000, 0); renderDateRangePicker({ defaultValue, initialMonth, maxDate, minDate }); assert.equal(dateRangePicker.state.displayYear, 2002); assert.equal(dateRangePicker.state.displayMonth, Months.MARCH); }); it("is defaultValue if set and initialMonth not set", () => { const defaultValue = [new Date(2007, 3, 4), null] as DateRange; const maxDate = new Date(2020, 0);
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
expose Months value mapping in datetime package (#439) * expose new `const enum Months` * replace all month numbers with enum values throughout code and tests * fixes #431
https://github.com/palantir/blueprint/commit/ab4f6a8587879913de2e57df0ac87ca51021ccca
packages/datetime/test/dateRangePickerTests.tsx
assert.equal(dateRangePicker.state.displayMonth, 2); }); it("is defaultValue if set and initialMonth not set", () => { const defaultValue = [new Date(2007, 3, 4), null] as DateRange; const maxDate = new Date(2020, 0); const minDate = new Date(2000, 0); renderDateRangePicker({ defaultValue, maxDate, minDate }); assert.equal(dateRangePicker.state.displayYear, 2007); assert.equal(dateRangePicker.state.displayMonth, 3); });
</s> remove assert.equal(dateRangePicker.state.displayMonth, 2); </s> add assert.equal(dateRangePicker.state.displayMonth, Months.MARCH); </s> remove const maxDate = new Date(2020, 0); const minDate = new Date(2000, 0); const value = [new Date(2007, 3, 4), null] as DateRange; </s> add const maxDate = new Date(2020, Months.JANUARY); const minDate = new Date(2000, Months.JANUARY); const value = [new Date(2007, Months.APRIL, 4), null] as DateRange; </s> remove const defaultValue = [new Date(2007, 3, 4), null] as DateRange; const initialMonth = new Date(2002, 2, 1); const maxDate = new Date(2020, 0); const minDate = new Date(2000, 0); </s> add const defaultValue = [new Date(2007, Months.APRIL, 4), null] as DateRange; const initialMonth = new Date(2002, Months.MARCH, 1); const maxDate = new Date(2020, Months.JANUARY); const minDate = new Date(2000, Months.JANUARY); </s> remove assert.equal(dateRangePicker.state.displayMonth, 3); </s> add assert.equal(dateRangePicker.state.displayMonth, Months.APRIL); </s> remove assert.equal(dateRangePicker.state.displayMonth, 3); </s> add assert.equal(dateRangePicker.state.displayMonth, Months.APRIL);
const defaultValue = [new Date(2007, Months.APRIL, 4), null] as DateRange; const maxDate = new Date(2020, Months.JANUARY); const minDate = new Date(2000, Months.JANUARY);
assert.equal(dateRangePicker.state.displayMonth, 2); }); it("is defaultValue if set and initialMonth not set", () => { const defaultValue = [new Date(2007, Months.APRIL, 4), null] as DateRange; const maxDate = new Date(2020, Months.JANUARY); const minDate = new Date(2000, Months.JANUARY); const defaultValue = [new Date(2007, Months.APRIL, 4), null] as DateRange; const maxDate = new Date(2020, Months.JANUARY); const minDate = new Date(2000, Months.JANUARY); const defaultValue = [new Date(2007, Months.APRIL, 4), null] as DateRange; const maxDate = new Date(2020, Months.JANUARY); const minDate = new Date(2000, Months.JANUARY); renderDateRangePicker({ defaultValue, maxDate, minDate }); assert.equal(dateRangePicker.state.displayYear, 2007); assert.equal(dateRangePicker.state.displayMonth, 3); });
[ "keep", "keep", "keep", "keep", "replace", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
expose Months value mapping in datetime package (#439) * expose new `const enum Months` * replace all month numbers with enum values throughout code and tests * fixes #431
https://github.com/palantir/blueprint/commit/ab4f6a8587879913de2e57df0ac87ca51021ccca
packages/datetime/test/dateRangePickerTests.tsx
const maxDate = new Date(2020, 0); const minDate = new Date(2000, 0); renderDateRangePicker({ defaultValue, maxDate, minDate }); assert.equal(dateRangePicker.state.displayYear, 2007); assert.equal(dateRangePicker.state.displayMonth, 3); }); it("is value if set and initialMonth not set", () => { const maxDate = new Date(2020, 0); const minDate = new Date(2000, 0);
</s> remove const maxDate = new Date(2020, 0); const minDate = new Date(2000, 0); const value = [new Date(2007, 3, 4), null] as DateRange; </s> add const maxDate = new Date(2020, Months.JANUARY); const minDate = new Date(2000, Months.JANUARY); const value = [new Date(2007, Months.APRIL, 4), null] as DateRange; </s> remove const defaultValue = [new Date(2007, 3, 4), null] as DateRange; const maxDate = new Date(2020, 0); const minDate = new Date(2000, 0); </s> add const defaultValue = [new Date(2007, Months.APRIL, 4), null] as DateRange; const maxDate = new Date(2020, Months.JANUARY); const minDate = new Date(2000, Months.JANUARY); </s> remove assert.equal(dateRangePicker.state.displayMonth, 2); </s> add assert.equal(dateRangePicker.state.displayMonth, Months.MARCH); </s> remove assert.equal(dateRangePicker.state.displayMonth, 3); </s> add assert.equal(dateRangePicker.state.displayMonth, Months.APRIL); </s> remove const maxDate = new Date(2020, 0); const minDate = new Date(2000, 0); </s> add const maxDate = new Date(2020, Months.JANUARY); const minDate = new Date(2000, Months.JANUARY);
assert.equal(dateRangePicker.state.displayMonth, Months.APRIL);
const maxDate = new Date(2020, 0); const minDate = new Date(2000, 0); renderDateRangePicker({ defaultValue, maxDate, minDate }); assert.equal(dateRangePicker.state.displayYear, 2007); assert.equal(dateRangePicker.state.displayMonth, Months.APRIL); }); it("is value if set and initialMonth not set", () => { const maxDate = new Date(2020, 0); const minDate = new Date(2000, 0);
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
expose Months value mapping in datetime package (#439) * expose new `const enum Months` * replace all month numbers with enum values throughout code and tests * fixes #431
https://github.com/palantir/blueprint/commit/ab4f6a8587879913de2e57df0ac87ca51021ccca
packages/datetime/test/dateRangePickerTests.tsx
assert.equal(dateRangePicker.state.displayMonth, 3); }); it("is value if set and initialMonth not set", () => { const maxDate = new Date(2020, 0); const minDate = new Date(2000, 0); const value = [new Date(2007, 3, 4), null] as DateRange; renderDateRangePicker({ maxDate, minDate, value }); assert.equal(dateRangePicker.state.displayYear, 2007); assert.equal(dateRangePicker.state.displayMonth, 3); });
</s> remove assert.equal(dateRangePicker.state.displayMonth, 3); </s> add assert.equal(dateRangePicker.state.displayMonth, Months.APRIL); </s> remove const defaultValue = [new Date(2007, 3, 4), null] as DateRange; const maxDate = new Date(2020, 0); const minDate = new Date(2000, 0); </s> add const defaultValue = [new Date(2007, Months.APRIL, 4), null] as DateRange; const maxDate = new Date(2020, Months.JANUARY); const minDate = new Date(2000, Months.JANUARY); </s> remove assert.equal(dateRangePicker.state.displayMonth, 2); </s> add assert.equal(dateRangePicker.state.displayMonth, Months.MARCH); </s> remove assert.equal(dateRangePicker.state.displayMonth, 3); </s> add assert.equal(dateRangePicker.state.displayMonth, Months.APRIL); </s> remove const defaultValue = [new Date(2007, 3, 4), null] as DateRange; const initialMonth = new Date(2002, 2, 1); const maxDate = new Date(2020, 0); const minDate = new Date(2000, 0); </s> add const defaultValue = [new Date(2007, Months.APRIL, 4), null] as DateRange; const initialMonth = new Date(2002, Months.MARCH, 1); const maxDate = new Date(2020, Months.JANUARY); const minDate = new Date(2000, Months.JANUARY);
const maxDate = new Date(2020, Months.JANUARY); const minDate = new Date(2000, Months.JANUARY); const value = [new Date(2007, Months.APRIL, 4), null] as DateRange;
assert.equal(dateRangePicker.state.displayMonth, 3); }); it("is value if set and initialMonth not set", () => { const maxDate = new Date(2020, Months.JANUARY); const minDate = new Date(2000, Months.JANUARY); const value = [new Date(2007, Months.APRIL, 4), null] as DateRange; const maxDate = new Date(2020, Months.JANUARY); const minDate = new Date(2000, Months.JANUARY); const value = [new Date(2007, Months.APRIL, 4), null] as DateRange; const maxDate = new Date(2020, Months.JANUARY); const minDate = new Date(2000, Months.JANUARY); const value = [new Date(2007, Months.APRIL, 4), null] as DateRange; renderDateRangePicker({ maxDate, minDate, value }); assert.equal(dateRangePicker.state.displayYear, 2007); assert.equal(dateRangePicker.state.displayMonth, 3); });
[ "keep", "keep", "keep", "keep", "replace", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
expose Months value mapping in datetime package (#439) * expose new `const enum Months` * replace all month numbers with enum values throughout code and tests * fixes #431
https://github.com/palantir/blueprint/commit/ab4f6a8587879913de2e57df0ac87ca51021ccca
packages/datetime/test/dateRangePickerTests.tsx
const minDate = new Date(2000, 0); const value = [new Date(2007, 3, 4), null] as DateRange; renderDateRangePicker({ maxDate, minDate, value }); assert.equal(dateRangePicker.state.displayYear, 2007); assert.equal(dateRangePicker.state.displayMonth, 3); }); it("is today if only maxDate/minDate set and today is in date range", () => { const maxDate = new Date(2020, 0); const minDate = new Date(2000, 0);
</s> remove const maxDate = new Date(2020, 0); const minDate = new Date(2000, 0); const value = [new Date(2007, 3, 4), null] as DateRange; </s> add const maxDate = new Date(2020, Months.JANUARY); const minDate = new Date(2000, Months.JANUARY); const value = [new Date(2007, Months.APRIL, 4), null] as DateRange; </s> remove const maxDate = new Date(2020, 0); const minDate = new Date(2000, 0); </s> add const maxDate = new Date(2020, Months.JANUARY); const minDate = new Date(2000, Months.JANUARY); </s> remove const defaultValue = [new Date(2007, 3, 4), null] as DateRange; const maxDate = new Date(2020, 0); const minDate = new Date(2000, 0); </s> add const defaultValue = [new Date(2007, Months.APRIL, 4), null] as DateRange; const maxDate = new Date(2020, Months.JANUARY); const minDate = new Date(2000, Months.JANUARY); </s> remove assert.equal(dateRangePicker.state.displayMonth, 2); </s> add assert.equal(dateRangePicker.state.displayMonth, Months.MARCH); </s> remove const defaultValue = [new Date(2007, 3, 4), null] as DateRange; const initialMonth = new Date(2002, 2, 1); const maxDate = new Date(2020, 0); const minDate = new Date(2000, 0); </s> add const defaultValue = [new Date(2007, Months.APRIL, 4), null] as DateRange; const initialMonth = new Date(2002, Months.MARCH, 1); const maxDate = new Date(2020, Months.JANUARY); const minDate = new Date(2000, Months.JANUARY);
assert.equal(dateRangePicker.state.displayMonth, Months.APRIL);
const minDate = new Date(2000, 0); const value = [new Date(2007, 3, 4), null] as DateRange; renderDateRangePicker({ maxDate, minDate, value }); assert.equal(dateRangePicker.state.displayYear, 2007); assert.equal(dateRangePicker.state.displayMonth, Months.APRIL); }); it("is today if only maxDate/minDate set and today is in date range", () => { const maxDate = new Date(2020, 0); const minDate = new Date(2000, 0);
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
expose Months value mapping in datetime package (#439) * expose new `const enum Months` * replace all month numbers with enum values throughout code and tests * fixes #431
https://github.com/palantir/blueprint/commit/ab4f6a8587879913de2e57df0ac87ca51021ccca
packages/datetime/test/dateRangePickerTests.tsx
assert.equal(dateRangePicker.state.displayMonth, 3); }); it("is today if only maxDate/minDate set and today is in date range", () => { const maxDate = new Date(2020, 0); const minDate = new Date(2000, 0); const today = new Date(); renderDateRangePicker({ maxDate, minDate}); assert.equal(dateRangePicker.state.displayYear, today.getFullYear()); assert.equal(dateRangePicker.state.displayMonth, today.getMonth()); });
</s> remove assert.equal(dateRangePicker.state.displayMonth, 3); </s> add assert.equal(dateRangePicker.state.displayMonth, Months.APRIL); </s> remove const maxDate = new Date(2005, 0); const minDate = new Date(2000, 0); </s> add const maxDate = new Date(2005, Months.JANUARY); const minDate = new Date(2000, Months.JANUARY); </s> remove assert.equal(root.state("displayMonth"), 3); </s> add assert.equal(root.state("displayMonth"), Months.APRIL); </s> remove assert.equal(dateRangePicker.state.displayMonth, 3); </s> add assert.equal(dateRangePicker.state.displayMonth, Months.APRIL); </s> remove const maxDate = new Date(2005, 0); const minDate = new Date(2000, 0); </s> add const maxDate = new Date(2005, Months.JANUARY); const minDate = new Date(2000, Months.JANUARY);
const maxDate = new Date(2020, Months.JANUARY); const minDate = new Date(2000, Months.JANUARY);
assert.equal(dateRangePicker.state.displayMonth, 3); }); it("is today if only maxDate/minDate set and today is in date range", () => { const maxDate = new Date(2020, Months.JANUARY); const minDate = new Date(2000, Months.JANUARY); const maxDate = new Date(2020, Months.JANUARY); const minDate = new Date(2000, Months.JANUARY); const today = new Date(); renderDateRangePicker({ maxDate, minDate}); assert.equal(dateRangePicker.state.displayYear, today.getFullYear()); assert.equal(dateRangePicker.state.displayMonth, today.getMonth()); });
[ "keep", "keep", "keep", "keep", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
expose Months value mapping in datetime package (#439) * expose new `const enum Months` * replace all month numbers with enum values throughout code and tests * fixes #431
https://github.com/palantir/blueprint/commit/ab4f6a8587879913de2e57df0ac87ca51021ccca
packages/datetime/test/dateRangePickerTests.tsx
assert.equal(dateRangePicker.state.displayMonth, today.getMonth()); }); it("is a day between minDate and maxDate if only maxDate/minDate set and today is not in range", () => { const maxDate = new Date(2005, 0); const minDate = new Date(2000, 0); renderDateRangePicker({ maxDate, minDate }); const { displayMonth, displayYear } = dateRangePicker.state; assert.isTrue(DateUtils.isDayInRange(new Date(displayYear, displayMonth), [minDate, maxDate])); });
</s> remove const maxDate = new Date(2005, 0); const minDate = new Date(2000, 0); </s> add const maxDate = new Date(2005, Months.JANUARY); const minDate = new Date(2000, Months.JANUARY); </s> remove const maxDate = new Date(2020, 0); const minDate = new Date(2000, 0); </s> add const maxDate = new Date(2020, Months.JANUARY); const minDate = new Date(2000, Months.JANUARY); </s> remove assert.equal(dateRangePicker.state.displayMonth, 3); </s> add assert.equal(dateRangePicker.state.displayMonth, Months.APRIL); </s> remove const NOVEMBER = 10; const DECEMBER = 11; </s> add </s> remove assert.equal(dateRangePicker.state.displayMonth, 3); </s> add assert.equal(dateRangePicker.state.displayMonth, Months.APRIL);
const maxDate = new Date(2005, Months.JANUARY); const minDate = new Date(2000, Months.JANUARY);
assert.equal(dateRangePicker.state.displayMonth, today.getMonth()); }); it("is a day between minDate and maxDate if only maxDate/minDate set and today is not in range", () => { const maxDate = new Date(2005, Months.JANUARY); const minDate = new Date(2000, Months.JANUARY); const maxDate = new Date(2005, Months.JANUARY); const minDate = new Date(2000, Months.JANUARY); renderDateRangePicker({ maxDate, minDate }); const { displayMonth, displayYear } = dateRangePicker.state; assert.isTrue(DateUtils.isDayInRange(new Date(displayYear, displayMonth), [minDate, maxDate])); });
[ "keep", "keep", "keep", "keep", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
expose Months value mapping in datetime package (#439) * expose new `const enum Months` * replace all month numbers with enum values throughout code and tests * fixes #431
https://github.com/palantir/blueprint/commit/ab4f6a8587879913de2e57df0ac87ca51021ccca
packages/datetime/test/dateRangePickerTests.tsx
assert.isTrue(DateUtils.isDayInRange(new Date(displayYear, displayMonth), [minDate, maxDate])); }); it("is initialMonth - 1 if initialMonth === maxDate month", () => { const NOVEMBER = 10; const DECEMBER = 11; const MAX_YEAR = 2016; const initialMonth = new Date(MAX_YEAR, DECEMBER, 1); const maxDate = new Date(MAX_YEAR, DECEMBER, 31); const minDate = new Date(2000, 0);
</s> remove const initialMonth = new Date(MAX_YEAR, DECEMBER, 1); const maxDate = new Date(MAX_YEAR, DECEMBER, 31); </s> add const initialMonth = new Date(MAX_YEAR, Months.DECEMBER, 1); const maxDate = new Date(MAX_YEAR, Months.DECEMBER, 31); </s> remove const DECEMBER = 11; </s> add </s> remove const initialMonth = new Date(YEAR, DECEMBER, 11); const maxDate = new Date(YEAR, DECEMBER, 15); const minDate = new Date(YEAR, DECEMBER, 1); </s> add const initialMonth = new Date(YEAR, Months.DECEMBER, 11); const maxDate = new Date(YEAR, Months.DECEMBER, 15); const minDate = new Date(YEAR, Months.DECEMBER, 1); </s> remove const maxDate = new Date(2005, 0); const minDate = new Date(2000, 0); </s> add const maxDate = new Date(2005, Months.JANUARY); const minDate = new Date(2000, Months.JANUARY); </s> remove const defaultValue = [new Date(2007, 3, 4), null] as DateRange; const initialMonth = new Date(2002, 2, 1); const maxDate = new Date(2020, 0); const minDate = new Date(2000, 0); </s> add const defaultValue = [new Date(2007, Months.APRIL, 4), null] as DateRange; const initialMonth = new Date(2002, Months.MARCH, 1); const maxDate = new Date(2020, Months.JANUARY); const minDate = new Date(2000, Months.JANUARY);
assert.isTrue(DateUtils.isDayInRange(new Date(displayYear, displayMonth), [minDate, maxDate])); }); it("is initialMonth - 1 if initialMonth === maxDate month", () => { const MAX_YEAR = 2016; const initialMonth = new Date(MAX_YEAR, DECEMBER, 1); const maxDate = new Date(MAX_YEAR, DECEMBER, 31); const minDate = new Date(2000, 0);
[ "keep", "keep", "keep", "keep", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
expose Months value mapping in datetime package (#439) * expose new `const enum Months` * replace all month numbers with enum values throughout code and tests * fixes #431
https://github.com/palantir/blueprint/commit/ab4f6a8587879913de2e57df0ac87ca51021ccca
packages/datetime/test/dateRangePickerTests.tsx
const NOVEMBER = 10; const DECEMBER = 11; const MAX_YEAR = 2016; const initialMonth = new Date(MAX_YEAR, DECEMBER, 1); const maxDate = new Date(MAX_YEAR, DECEMBER, 31); const minDate = new Date(2000, 0); renderDateRangePicker({ initialMonth, maxDate, minDate }); assert.equal(dateRangePicker.state.displayYear, MAX_YEAR);
</s> remove const NOVEMBER = 10; const DECEMBER = 11; </s> add </s> remove const initialMonth = new Date(YEAR, DECEMBER, 11); const maxDate = new Date(YEAR, DECEMBER, 15); const minDate = new Date(YEAR, DECEMBER, 1); </s> add const initialMonth = new Date(YEAR, Months.DECEMBER, 11); const maxDate = new Date(YEAR, Months.DECEMBER, 15); const minDate = new Date(YEAR, Months.DECEMBER, 1); </s> remove const DECEMBER = 11; </s> add </s> remove const defaultValue = [new Date(2007, 3, 4), null] as DateRange; const initialMonth = new Date(2002, 2, 1); const maxDate = new Date(2020, 0); const minDate = new Date(2000, 0); </s> add const defaultValue = [new Date(2007, Months.APRIL, 4), null] as DateRange; const initialMonth = new Date(2002, Months.MARCH, 1); const maxDate = new Date(2020, Months.JANUARY); const minDate = new Date(2000, Months.JANUARY); </s> remove assert.equal(dateRangePicker.state.displayMonth, 3); </s> add assert.equal(dateRangePicker.state.displayMonth, Months.APRIL);
const initialMonth = new Date(MAX_YEAR, Months.DECEMBER, 1); const maxDate = new Date(MAX_YEAR, Months.DECEMBER, 31);
const NOVEMBER = 10; const DECEMBER = 11; const MAX_YEAR = 2016; const initialMonth = new Date(MAX_YEAR, Months.DECEMBER, 1); const maxDate = new Date(MAX_YEAR, Months.DECEMBER, 31); const initialMonth = new Date(MAX_YEAR, Months.DECEMBER, 1); const maxDate = new Date(MAX_YEAR, Months.DECEMBER, 31); const minDate = new Date(2000, 0); renderDateRangePicker({ initialMonth, maxDate, minDate }); assert.equal(dateRangePicker.state.displayYear, MAX_YEAR);
[ "keep", "keep", "keep", "keep", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
expose Months value mapping in datetime package (#439) * expose new `const enum Months` * replace all month numbers with enum values throughout code and tests * fixes #431
https://github.com/palantir/blueprint/commit/ab4f6a8587879913de2e57df0ac87ca51021ccca
packages/datetime/test/dateRangePickerTests.tsx
renderDateRangePicker({ initialMonth, maxDate, minDate }); assert.equal(dateRangePicker.state.displayYear, MAX_YEAR); assert.equal(dateRangePicker.state.displayMonth, NOVEMBER); }); it("is value - 1 if set and initialMonth not set and value month === maxDate month", () => { const value = [new Date(2017, 9, 4), null] as DateRange; const maxDate = new Date(2017, 9, 15);
</s> remove const maxDate = new Date(2020, 0); const minDate = new Date(2000, 0); const value = [new Date(2007, 3, 4), null] as DateRange; </s> add const maxDate = new Date(2020, Months.JANUARY); const minDate = new Date(2000, Months.JANUARY); const value = [new Date(2007, Months.APRIL, 4), null] as DateRange; </s> remove assert.equal(dateRangePicker.state.displayMonth, 3); </s> add assert.equal(dateRangePicker.state.displayMonth, Months.APRIL); </s> remove assert.equal(dateRangePicker.state.displayMonth, 2); </s> add assert.equal(dateRangePicker.state.displayMonth, Months.MARCH); </s> remove const defaultValue = [new Date(2007, 3, 4), null] as DateRange; const maxDate = new Date(2020, 0); const minDate = new Date(2000, 0); </s> add const defaultValue = [new Date(2007, Months.APRIL, 4), null] as DateRange; const maxDate = new Date(2020, Months.JANUARY); const minDate = new Date(2000, Months.JANUARY); </s> remove const defaultValue = [new Date(2007, 3, 4), null] as DateRange; const initialMonth = new Date(2002, 2, 1); const maxDate = new Date(2020, 0); const minDate = new Date(2000, 0); </s> add const defaultValue = [new Date(2007, Months.APRIL, 4), null] as DateRange; const initialMonth = new Date(2002, Months.MARCH, 1); const maxDate = new Date(2020, Months.JANUARY); const minDate = new Date(2000, Months.JANUARY);
assert.equal(dateRangePicker.state.displayMonth, Months.NOVEMBER);
renderDateRangePicker({ initialMonth, maxDate, minDate }); assert.equal(dateRangePicker.state.displayYear, MAX_YEAR); assert.equal(dateRangePicker.state.displayMonth, Months.NOVEMBER); }); it("is value - 1 if set and initialMonth not set and value month === maxDate month", () => { const value = [new Date(2017, 9, 4), null] as DateRange; const maxDate = new Date(2017, 9, 15);
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
expose Months value mapping in datetime package (#439) * expose new `const enum Months` * replace all month numbers with enum values throughout code and tests * fixes #431
https://github.com/palantir/blueprint/commit/ab4f6a8587879913de2e57df0ac87ca51021ccca
packages/datetime/test/dateRangePickerTests.tsx
assert.equal(dateRangePicker.state.displayMonth, 8); }); it("is initialMonth if initialMonth === minDate month and initialMonth === maxDate month", () => { const DECEMBER = 11; const YEAR = 2016; const initialMonth = new Date(YEAR, DECEMBER, 11); const maxDate = new Date(YEAR, DECEMBER, 15); const minDate = new Date(YEAR, DECEMBER, 1);
</s> remove const initialMonth = new Date(YEAR, DECEMBER, 11); const maxDate = new Date(YEAR, DECEMBER, 15); const minDate = new Date(YEAR, DECEMBER, 1); </s> add const initialMonth = new Date(YEAR, Months.DECEMBER, 11); const maxDate = new Date(YEAR, Months.DECEMBER, 15); const minDate = new Date(YEAR, Months.DECEMBER, 1); </s> remove const NOVEMBER = 10; const DECEMBER = 11; </s> add </s> remove const initialMonth = new Date(MAX_YEAR, DECEMBER, 1); const maxDate = new Date(MAX_YEAR, DECEMBER, 31); </s> add const initialMonth = new Date(MAX_YEAR, Months.DECEMBER, 1); const maxDate = new Date(MAX_YEAR, Months.DECEMBER, 31); </s> remove assert.equal(dateRangePicker.state.displayMonth, NOVEMBER); </s> add assert.equal(dateRangePicker.state.displayMonth, Months.NOVEMBER); </s> remove const defaultValue = [new Date(2007, 3, 4), null] as DateRange; const initialMonth = new Date(2002, 2, 1); const maxDate = new Date(2020, 0); const minDate = new Date(2000, 0); </s> add const defaultValue = [new Date(2007, Months.APRIL, 4), null] as DateRange; const initialMonth = new Date(2002, Months.MARCH, 1); const maxDate = new Date(2020, Months.JANUARY); const minDate = new Date(2000, Months.JANUARY);
assert.equal(dateRangePicker.state.displayMonth, 8); }); it("is initialMonth if initialMonth === minDate month and initialMonth === maxDate month", () => { const YEAR = 2016; const initialMonth = new Date(YEAR, DECEMBER, 11); const maxDate = new Date(YEAR, DECEMBER, 15); const minDate = new Date(YEAR, DECEMBER, 1);
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
expose Months value mapping in datetime package (#439) * expose new `const enum Months` * replace all month numbers with enum values throughout code and tests * fixes #431
https://github.com/palantir/blueprint/commit/ab4f6a8587879913de2e57df0ac87ca51021ccca
packages/datetime/test/dateRangePickerTests.tsx
it("is initialMonth if initialMonth === minDate month and initialMonth === maxDate month", () => { const DECEMBER = 11; const YEAR = 2016; const initialMonth = new Date(YEAR, DECEMBER, 11); const maxDate = new Date(YEAR, DECEMBER, 15); const minDate = new Date(YEAR, DECEMBER, 1); renderDateRangePicker({ initialMonth, maxDate, minDate }); assert.equal(dateRangePicker.state.displayYear, YEAR); assert.equal(dateRangePicker.state.displayMonth, DECEMBER);
</s> remove const DECEMBER = 11; </s> add </s> remove const NOVEMBER = 10; const DECEMBER = 11; </s> add </s> remove const initialMonth = new Date(MAX_YEAR, DECEMBER, 1); const maxDate = new Date(MAX_YEAR, DECEMBER, 31); </s> add const initialMonth = new Date(MAX_YEAR, Months.DECEMBER, 1); const maxDate = new Date(MAX_YEAR, Months.DECEMBER, 31); </s> remove assert.equal(dateRangePicker.state.displayMonth, NOVEMBER); </s> add assert.equal(dateRangePicker.state.displayMonth, Months.NOVEMBER); </s> remove const defaultValue = [new Date(2007, 3, 4), null] as DateRange; const initialMonth = new Date(2002, 2, 1); const maxDate = new Date(2020, 0); const minDate = new Date(2000, 0); </s> add const defaultValue = [new Date(2007, Months.APRIL, 4), null] as DateRange; const initialMonth = new Date(2002, Months.MARCH, 1); const maxDate = new Date(2020, Months.JANUARY); const minDate = new Date(2000, Months.JANUARY);
const initialMonth = new Date(YEAR, Months.DECEMBER, 11); const maxDate = new Date(YEAR, Months.DECEMBER, 15); const minDate = new Date(YEAR, Months.DECEMBER, 1);
it("is initialMonth if initialMonth === minDate month and initialMonth === maxDate month", () => { const DECEMBER = 11; const YEAR = 2016; const initialMonth = new Date(YEAR, Months.DECEMBER, 11); const maxDate = new Date(YEAR, Months.DECEMBER, 15); const minDate = new Date(YEAR, Months.DECEMBER, 1); const initialMonth = new Date(YEAR, Months.DECEMBER, 11); const maxDate = new Date(YEAR, Months.DECEMBER, 15); const minDate = new Date(YEAR, Months.DECEMBER, 1); const initialMonth = new Date(YEAR, Months.DECEMBER, 11); const maxDate = new Date(YEAR, Months.DECEMBER, 15); const minDate = new Date(YEAR, Months.DECEMBER, 1); renderDateRangePicker({ initialMonth, maxDate, minDate }); assert.equal(dateRangePicker.state.displayYear, YEAR); assert.equal(dateRangePicker.state.displayMonth, DECEMBER);
[ "keep", "keep", "keep", "keep", "replace", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
expose Months value mapping in datetime package (#439) * expose new `const enum Months` * replace all month numbers with enum values throughout code and tests * fixes #431
https://github.com/palantir/blueprint/commit/ab4f6a8587879913de2e57df0ac87ca51021ccca
packages/datetime/test/dateRangePickerTests.tsx
renderDateRangePicker({ initialMonth, maxDate, minDate }); assert.equal(dateRangePicker.state.displayYear, YEAR); assert.equal(dateRangePicker.state.displayMonth, DECEMBER); }); }); describe("minDate/maxDate bounds", () => { it("maxDate must be later than minDate", () => {
</s> remove const minDate = new Date(2000, 0, 10); const maxDate = new Date(2000, 0, 8); </s> add const minDate = new Date(2000, Months.JANUARY, 10); const maxDate = new Date(2000, Months.JANUARY, 8); </s> remove const MIN_DATE = new Date(2015, 0, 7); const MAX_DATE = new Date(2015, 0, 12); </s> add const MIN_DATE = new Date(2015, Months.JANUARY, 7); const MAX_DATE = new Date(2015, Months.JANUARY, 12); </s> remove const initialMonth = new Date(YEAR, DECEMBER, 11); const maxDate = new Date(YEAR, DECEMBER, 15); const minDate = new Date(YEAR, DECEMBER, 1); </s> add const initialMonth = new Date(YEAR, Months.DECEMBER, 11); const maxDate = new Date(YEAR, Months.DECEMBER, 15); const minDate = new Date(YEAR, Months.DECEMBER, 1); </s> remove assert.equal(dateRangePicker.state.displayMonth, NOVEMBER); </s> add assert.equal(dateRangePicker.state.displayMonth, Months.NOVEMBER); </s> remove assert.equal(dateRangePicker.state.displayMonth, 2); </s> add assert.equal(dateRangePicker.state.displayMonth, Months.MARCH);
assert.equal(dateRangePicker.state.displayMonth, Months.DECEMBER);
renderDateRangePicker({ initialMonth, maxDate, minDate }); assert.equal(dateRangePicker.state.displayYear, YEAR); assert.equal(dateRangePicker.state.displayMonth, Months.DECEMBER); }); }); describe("minDate/maxDate bounds", () => { it("maxDate must be later than minDate", () => {
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
expose Months value mapping in datetime package (#439) * expose new `const enum Months` * replace all month numbers with enum values throughout code and tests * fixes #431
https://github.com/palantir/blueprint/commit/ab4f6a8587879913de2e57df0ac87ca51021ccca
packages/datetime/test/dateRangePickerTests.tsx
}); describe("minDate/maxDate bounds", () => { it("maxDate must be later than minDate", () => { const minDate = new Date(2000, 0, 10); const maxDate = new Date(2000, 0, 8); assert.throws(() => { renderDateRangePicker({ minDate, maxDate }); }, Errors.DATERANGEPICKER_MAX_DATE_INVALID); });
</s> remove const MIN_DATE = new Date(2015, 0, 7); const MAX_DATE = new Date(2015, 0, 12); </s> add const MIN_DATE = new Date(2015, Months.JANUARY, 7); const MAX_DATE = new Date(2015, Months.JANUARY, 12); </s> remove assert.equal(dateRangePicker.state.displayMonth, DECEMBER); </s> add assert.equal(dateRangePicker.state.displayMonth, Months.DECEMBER); </s> remove const minDate = new Date(2000, 0, 10); </s> add const minDate = new Date(2000, Months.JANUARY, 10); </s> remove const minDate = new Date(2015, 0, 5); const maxDate = new Date(2015, 0, 7); const initialMonth = new Date(2015, 1, 12); </s> add const minDate = new Date(2015, Months.JANUARY, 5); const maxDate = new Date(2015, Months.JANUARY, 7); const initialMonth = new Date(2015, Months.FEBRUARY, 12); </s> remove const minDate = new Date(2015, 0, 5); const maxDate = new Date(2015, 0, 7); const value = [new Date(2015, 0, 12), null] as DateRange; </s> add const minDate = new Date(2015, Months.JANUARY, 5); const maxDate = new Date(2015, Months.JANUARY, 7); const value = [new Date(2015, Months.JANUARY, 12), null] as DateRange;
const minDate = new Date(2000, Months.JANUARY, 10); const maxDate = new Date(2000, Months.JANUARY, 8);
}); describe("minDate/maxDate bounds", () => { it("maxDate must be later than minDate", () => { const minDate = new Date(2000, Months.JANUARY, 10); const maxDate = new Date(2000, Months.JANUARY, 8); const minDate = new Date(2000, Months.JANUARY, 10); const maxDate = new Date(2000, Months.JANUARY, 8); assert.throws(() => { renderDateRangePicker({ minDate, maxDate }); }, Errors.DATERANGEPICKER_MAX_DATE_INVALID); });
[ "keep", "keep", "keep", "keep", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
expose Months value mapping in datetime package (#439) * expose new `const enum Months` * replace all month numbers with enum values throughout code and tests * fixes #431
https://github.com/palantir/blueprint/commit/ab4f6a8587879913de2e57df0ac87ca51021ccca
packages/datetime/test/dateRangePickerTests.tsx
}, Errors.DATERANGEPICKER_MAX_DATE_INVALID); }); it("only days outside bounds have disabled class", () => { const minDate = new Date(2000, 0, 10); const initialMonth = minDate; renderDateRangePicker({ initialMonth, minDate }); const disabledDay = getDayElement(8); const selectableDay = getDayElement(10); assert.isTrue(disabledDay.classList.contains(DateClasses.DATEPICKER_DAY_DISABLED));
</s> remove const minDate = new Date(2000, 0, 10); </s> add const minDate = new Date(2000, Months.JANUARY, 10); </s> remove <DatePicker initialMonth={new Date(2015, 0, 12)} minDate={MIN_DATE} maxDate={MAX_DATE} />, </s> add <DatePicker initialMonth={new Date(2015, Months.JANUARY, 12)} minDate={MIN_DATE} maxDate={MAX_DATE} />, </s> remove const minDate = new Date(2000, 0, 10); const maxDate = new Date(2000, 0, 8); </s> add const minDate = new Date(2000, Months.JANUARY, 10); const maxDate = new Date(2000, Months.JANUARY, 8); </s> remove const minDate = new Date(2015, 0, 5); const maxDate = new Date(2015, 0, 7); const initialMonth = new Date(2015, 0, 12); </s> add const minDate = new Date(2015, Months.JANUARY, 5); const maxDate = new Date(2015, Months.JANUARY, 7); const initialMonth = new Date(2015, Months.JANUARY, 12); </s> remove const minDate = new Date(2015, 0, 5); const maxDate = new Date(2015, 0, 7); const initialMonth = new Date(2015, 1, 12); </s> add const minDate = new Date(2015, Months.JANUARY, 5); const maxDate = new Date(2015, Months.JANUARY, 7); const initialMonth = new Date(2015, Months.FEBRUARY, 12);
const minDate = new Date(2000, Months.JANUARY, 10);
}, Errors.DATERANGEPICKER_MAX_DATE_INVALID); }); it("only days outside bounds have disabled class", () => { const minDate = new Date(2000, Months.JANUARY, 10); const initialMonth = minDate; renderDateRangePicker({ initialMonth, minDate }); const disabledDay = getDayElement(8); const selectableDay = getDayElement(10); assert.isTrue(disabledDay.classList.contains(DateClasses.DATEPICKER_DAY_DISABLED));
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
expose Months value mapping in datetime package (#439) * expose new `const enum Months` * replace all month numbers with enum values throughout code and tests * fixes #431
https://github.com/palantir/blueprint/commit/ab4f6a8587879913de2e57df0ac87ca51021ccca
packages/datetime/test/dateRangePickerTests.tsx
assert.isFalse(selectableDay.classList.contains(DateClasses.DATEPICKER_DAY_DISABLED)); }); it("an error is thrown if defaultValue is outside bounds", () => { const minDate = new Date(2015, 0, 5); const maxDate = new Date(2015, 0, 7); const defaultValue = [new Date(2015, 0, 12), null] as DateRange; assert.throws(() => { renderDateRangePicker({ defaultValue, minDate, maxDate }); }, Errors.DATERANGEPICKER_DEFAULT_VALUE_INVALID); });
</s> remove const minDate = new Date(2015, 0, 5); const maxDate = new Date(2015, 0, 7); const value = [new Date(2015, 0, 12), null] as DateRange; </s> add const minDate = new Date(2015, Months.JANUARY, 5); const maxDate = new Date(2015, Months.JANUARY, 7); const value = [new Date(2015, Months.JANUARY, 12), null] as DateRange; </s> remove const minDate = new Date(2015, 0, 5); const maxDate = new Date(2015, 0, 7); const initialMonth = new Date(2015, 1, 12); </s> add const minDate = new Date(2015, Months.JANUARY, 5); const maxDate = new Date(2015, Months.JANUARY, 7); const initialMonth = new Date(2015, Months.FEBRUARY, 12); </s> remove const minDate = new Date(2015, 0, 5); const maxDate = new Date(2015, 0, 7); const initialMonth = new Date(2015, 0, 12); </s> add const minDate = new Date(2015, Months.JANUARY, 5); const maxDate = new Date(2015, Months.JANUARY, 7); const initialMonth = new Date(2015, Months.JANUARY, 12); </s> remove const minDate = new Date(2015, 0, 5); const maxDate = new Date(2015, 0, 7); </s> add const minDate = new Date(2015, Months.JANUARY, 5); const maxDate = new Date(2015, Months.JANUARY, 7); </s> remove const defaultValue = [new Date(2010, 1, 2), null] as DateRange; const value = [new Date(2010, 0, 1), null] as DateRange; </s> add const defaultValue = [new Date(2010, Months.FEBRUARY, 2), null] as DateRange; const value = [new Date(2010, Months.JANUARY, 1), null] as DateRange;
const minDate = new Date(2015, Months.JANUARY, 5); const maxDate = new Date(2015, Months.JANUARY, 7); const defaultValue = [new Date(2015, Months.JANUARY, 12), null] as DateRange;
assert.isFalse(selectableDay.classList.contains(DateClasses.DATEPICKER_DAY_DISABLED)); }); it("an error is thrown if defaultValue is outside bounds", () => { const minDate = new Date(2015, Months.JANUARY, 5); const maxDate = new Date(2015, Months.JANUARY, 7); const defaultValue = [new Date(2015, Months.JANUARY, 12), null] as DateRange; const minDate = new Date(2015, Months.JANUARY, 5); const maxDate = new Date(2015, Months.JANUARY, 7); const defaultValue = [new Date(2015, Months.JANUARY, 12), null] as DateRange; const minDate = new Date(2015, Months.JANUARY, 5); const maxDate = new Date(2015, Months.JANUARY, 7); const defaultValue = [new Date(2015, Months.JANUARY, 12), null] as DateRange; assert.throws(() => { renderDateRangePicker({ defaultValue, minDate, maxDate }); }, Errors.DATERANGEPICKER_DEFAULT_VALUE_INVALID); });
[ "keep", "keep", "keep", "keep", "replace", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
expose Months value mapping in datetime package (#439) * expose new `const enum Months` * replace all month numbers with enum values throughout code and tests * fixes #431
https://github.com/palantir/blueprint/commit/ab4f6a8587879913de2e57df0ac87ca51021ccca
packages/datetime/test/dateRangePickerTests.tsx
}, Errors.DATERANGEPICKER_DEFAULT_VALUE_INVALID); }); it("an error is thrown if initialMonth is outside month bounds", () => { const minDate = new Date(2015, 0, 5); const maxDate = new Date(2015, 0, 7); const initialMonth = new Date(2015, 1, 12); assert.throws(() => { renderDateRangePicker({ initialMonth, minDate, maxDate }); }, Errors.DATERANGEPICKER_INITIAL_MONTH_INVALID); });
</s> remove const minDate = new Date(2015, 0, 5); const maxDate = new Date(2015, 0, 7); const initialMonth = new Date(2015, 0, 12); </s> add const minDate = new Date(2015, Months.JANUARY, 5); const maxDate = new Date(2015, Months.JANUARY, 7); const initialMonth = new Date(2015, Months.JANUARY, 12); </s> remove const minDate = new Date(2015, 0, 5); const maxDate = new Date(2015, 0, 7); const defaultValue = [new Date(2015, 0, 12), null] as DateRange; </s> add const minDate = new Date(2015, Months.JANUARY, 5); const maxDate = new Date(2015, Months.JANUARY, 7); const defaultValue = [new Date(2015, Months.JANUARY, 12), null] as DateRange; </s> remove const minDate = new Date(2015, 0, 5); const maxDate = new Date(2015, 0, 7); const value = [new Date(2015, 0, 12), null] as DateRange; </s> add const minDate = new Date(2015, Months.JANUARY, 5); const maxDate = new Date(2015, Months.JANUARY, 7); const value = [new Date(2015, Months.JANUARY, 12), null] as DateRange; </s> remove const minDate = new Date(2015, 0, 5); const maxDate = new Date(2015, 0, 7); </s> add const minDate = new Date(2015, Months.JANUARY, 5); const maxDate = new Date(2015, Months.JANUARY, 7); </s> remove const MIN_DATE = new Date(2015, 0, 7); const MAX_DATE = new Date(2015, 0, 12); </s> add const MIN_DATE = new Date(2015, Months.JANUARY, 7); const MAX_DATE = new Date(2015, Months.JANUARY, 12);
const minDate = new Date(2015, Months.JANUARY, 5); const maxDate = new Date(2015, Months.JANUARY, 7); const initialMonth = new Date(2015, Months.FEBRUARY, 12);
}, Errors.DATERANGEPICKER_DEFAULT_VALUE_INVALID); }); it("an error is thrown if initialMonth is outside month bounds", () => { const minDate = new Date(2015, Months.JANUARY, 5); const maxDate = new Date(2015, Months.JANUARY, 7); const initialMonth = new Date(2015, Months.FEBRUARY, 12); const minDate = new Date(2015, Months.JANUARY, 5); const maxDate = new Date(2015, Months.JANUARY, 7); const initialMonth = new Date(2015, Months.FEBRUARY, 12); const minDate = new Date(2015, Months.JANUARY, 5); const maxDate = new Date(2015, Months.JANUARY, 7); const initialMonth = new Date(2015, Months.FEBRUARY, 12); assert.throws(() => { renderDateRangePicker({ initialMonth, minDate, maxDate }); }, Errors.DATERANGEPICKER_INITIAL_MONTH_INVALID); });
[ "keep", "keep", "keep", "keep", "replace", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
expose Months value mapping in datetime package (#439) * expose new `const enum Months` * replace all month numbers with enum values throughout code and tests * fixes #431
https://github.com/palantir/blueprint/commit/ab4f6a8587879913de2e57df0ac87ca51021ccca
packages/datetime/test/dateRangePickerTests.tsx
}, Errors.DATERANGEPICKER_INITIAL_MONTH_INVALID); }); it("an error is not thrown if initialMonth is outside day bounds but inside month bounds", () => { const minDate = new Date(2015, 0, 5); const maxDate = new Date(2015, 0, 7); const initialMonth = new Date(2015, 0, 12); assert.doesNotThrow(() => { renderDateRangePicker({ initialMonth, minDate, maxDate }); }); });
</s> remove const minDate = new Date(2015, 0, 5); const maxDate = new Date(2015, 0, 7); const initialMonth = new Date(2015, 1, 12); </s> add const minDate = new Date(2015, Months.JANUARY, 5); const maxDate = new Date(2015, Months.JANUARY, 7); const initialMonth = new Date(2015, Months.FEBRUARY, 12); </s> remove const minDate = new Date(2015, 0, 5); const maxDate = new Date(2015, 0, 7); const value = [new Date(2015, 0, 12), null] as DateRange; </s> add const minDate = new Date(2015, Months.JANUARY, 5); const maxDate = new Date(2015, Months.JANUARY, 7); const value = [new Date(2015, Months.JANUARY, 12), null] as DateRange; </s> remove <DatePicker initialMonth={new Date(2015, 0, 12)} minDate={MIN_DATE} maxDate={MAX_DATE} />, </s> add <DatePicker initialMonth={new Date(2015, Months.JANUARY, 12)} minDate={MIN_DATE} maxDate={MAX_DATE} />, </s> remove const minDate = new Date(2015, 0, 5); const maxDate = new Date(2015, 0, 7); const defaultValue = [new Date(2015, 0, 12), null] as DateRange; </s> add const minDate = new Date(2015, Months.JANUARY, 5); const maxDate = new Date(2015, Months.JANUARY, 7); const defaultValue = [new Date(2015, Months.JANUARY, 12), null] as DateRange; </s> remove const minDate = new Date(2015, 0, 5); const maxDate = new Date(2015, 0, 7); </s> add const minDate = new Date(2015, Months.JANUARY, 5); const maxDate = new Date(2015, Months.JANUARY, 7);
const minDate = new Date(2015, Months.JANUARY, 5); const maxDate = new Date(2015, Months.JANUARY, 7); const initialMonth = new Date(2015, Months.JANUARY, 12);
}, Errors.DATERANGEPICKER_INITIAL_MONTH_INVALID); }); it("an error is not thrown if initialMonth is outside day bounds but inside month bounds", () => { const minDate = new Date(2015, Months.JANUARY, 5); const maxDate = new Date(2015, Months.JANUARY, 7); const initialMonth = new Date(2015, Months.JANUARY, 12); const minDate = new Date(2015, Months.JANUARY, 5); const maxDate = new Date(2015, Months.JANUARY, 7); const initialMonth = new Date(2015, Months.JANUARY, 12); const minDate = new Date(2015, Months.JANUARY, 5); const maxDate = new Date(2015, Months.JANUARY, 7); const initialMonth = new Date(2015, Months.JANUARY, 12); assert.doesNotThrow(() => { renderDateRangePicker({ initialMonth, minDate, maxDate }); }); });
[ "keep", "keep", "keep", "keep", "replace", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
expose Months value mapping in datetime package (#439) * expose new `const enum Months` * replace all month numbers with enum values throughout code and tests * fixes #431
https://github.com/palantir/blueprint/commit/ab4f6a8587879913de2e57df0ac87ca51021ccca
packages/datetime/test/dateRangePickerTests.tsx
}); }); it("an error is thrown if value is outside bounds", () => { const minDate = new Date(2015, 0, 5); const maxDate = new Date(2015, 0, 7); const value = [new Date(2015, 0, 12), null] as DateRange; assert.throws(() => { renderDateRangePicker({ value, minDate, maxDate }); }, Errors.DATERANGEPICKER_VALUE_INVALID); });
</s> remove const minDate = new Date(2015, 0, 5); const maxDate = new Date(2015, 0, 7); const defaultValue = [new Date(2015, 0, 12), null] as DateRange; </s> add const minDate = new Date(2015, Months.JANUARY, 5); const maxDate = new Date(2015, Months.JANUARY, 7); const defaultValue = [new Date(2015, Months.JANUARY, 12), null] as DateRange; </s> remove const minDate = new Date(2015, 0, 5); const maxDate = new Date(2015, 0, 7); const initialMonth = new Date(2015, 1, 12); </s> add const minDate = new Date(2015, Months.JANUARY, 5); const maxDate = new Date(2015, Months.JANUARY, 7); const initialMonth = new Date(2015, Months.FEBRUARY, 12); </s> remove const minDate = new Date(2015, 0, 5); const maxDate = new Date(2015, 0, 7); const initialMonth = new Date(2015, 0, 12); </s> add const minDate = new Date(2015, Months.JANUARY, 5); const maxDate = new Date(2015, Months.JANUARY, 7); const initialMonth = new Date(2015, Months.JANUARY, 12); </s> remove const minDate = new Date(2015, 0, 5); const maxDate = new Date(2015, 0, 7); </s> add const minDate = new Date(2015, Months.JANUARY, 5); const maxDate = new Date(2015, Months.JANUARY, 7); </s> remove const minDate = new Date(2015, 0, 5); const maxDate = new Date(2015, 0, 7); </s> add const minDate = new Date(2015, Months.JANUARY, 5); const maxDate = new Date(2015, Months.JANUARY, 7);
const minDate = new Date(2015, Months.JANUARY, 5); const maxDate = new Date(2015, Months.JANUARY, 7); const value = [new Date(2015, Months.JANUARY, 12), null] as DateRange;
}); }); it("an error is thrown if value is outside bounds", () => { const minDate = new Date(2015, Months.JANUARY, 5); const maxDate = new Date(2015, Months.JANUARY, 7); const value = [new Date(2015, Months.JANUARY, 12), null] as DateRange; const minDate = new Date(2015, Months.JANUARY, 5); const maxDate = new Date(2015, Months.JANUARY, 7); const value = [new Date(2015, Months.JANUARY, 12), null] as DateRange; const minDate = new Date(2015, Months.JANUARY, 5); const maxDate = new Date(2015, Months.JANUARY, 7); const value = [new Date(2015, Months.JANUARY, 12), null] as DateRange; assert.throws(() => { renderDateRangePicker({ value, minDate, maxDate }); }, Errors.DATERANGEPICKER_VALUE_INVALID); });
[ "keep", "keep", "keep", "keep", "replace", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
expose Months value mapping in datetime package (#439) * expose new `const enum Months` * replace all month numbers with enum values throughout code and tests * fixes #431
https://github.com/palantir/blueprint/commit/ab4f6a8587879913de2e57df0ac87ca51021ccca
packages/datetime/test/dateRangePickerTests.tsx
}, Errors.DATERANGEPICKER_VALUE_INVALID); }); it("onChange not fired when a day outside of bounds is clicked", () => { const minDate = new Date(2015, 0, 5); const maxDate = new Date(2015, 0, 7); renderDateRangePicker({ minDate, maxDate }); assert.isTrue(onDateRangePickerChangeSpy.notCalled); clickDay(10); assert.isTrue(onDateRangePickerChangeSpy.notCalled); });
</s> remove const minDate = new Date(2015, 0, 5); const maxDate = new Date(2015, 0, 7); const initialMonth = new Date(2015, 0, 12); </s> add const minDate = new Date(2015, Months.JANUARY, 5); const maxDate = new Date(2015, Months.JANUARY, 7); const initialMonth = new Date(2015, Months.JANUARY, 12); </s> remove const minDate = new Date(2015, 0, 5); const maxDate = new Date(2015, 0, 7); const value = [new Date(2015, 0, 12), null] as DateRange; </s> add const minDate = new Date(2015, Months.JANUARY, 5); const maxDate = new Date(2015, Months.JANUARY, 7); const value = [new Date(2015, Months.JANUARY, 12), null] as DateRange; </s> remove const minDate = new Date(2015, 0, 5); const maxDate = new Date(2015, 0, 7); </s> add const minDate = new Date(2015, Months.JANUARY, 5); const maxDate = new Date(2015, Months.JANUARY, 7); </s> remove const minDate = new Date(2015, 0, 5); const maxDate = new Date(2015, 0, 7); const initialMonth = new Date(2015, 1, 12); </s> add const minDate = new Date(2015, Months.JANUARY, 5); const maxDate = new Date(2015, Months.JANUARY, 7); const initialMonth = new Date(2015, Months.FEBRUARY, 12); </s> remove const minDate = new Date(2015, 0, 5); const maxDate = new Date(2015, 0, 7); const defaultValue = [new Date(2015, 0, 12), null] as DateRange; </s> add const minDate = new Date(2015, Months.JANUARY, 5); const maxDate = new Date(2015, Months.JANUARY, 7); const defaultValue = [new Date(2015, Months.JANUARY, 12), null] as DateRange;
const minDate = new Date(2015, Months.JANUARY, 5); const maxDate = new Date(2015, Months.JANUARY, 7);
}, Errors.DATERANGEPICKER_VALUE_INVALID); }); it("onChange not fired when a day outside of bounds is clicked", () => { const minDate = new Date(2015, Months.JANUARY, 5); const maxDate = new Date(2015, Months.JANUARY, 7); const minDate = new Date(2015, Months.JANUARY, 5); const maxDate = new Date(2015, Months.JANUARY, 7); renderDateRangePicker({ minDate, maxDate }); assert.isTrue(onDateRangePickerChangeSpy.notCalled); clickDay(10); assert.isTrue(onDateRangePickerChangeSpy.notCalled); });
[ "keep", "keep", "keep", "keep", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
expose Months value mapping in datetime package (#439) * expose new `const enum Months` * replace all month numbers with enum values throughout code and tests * fixes #431
https://github.com/palantir/blueprint/commit/ab4f6a8587879913de2e57df0ac87ca51021ccca
packages/datetime/test/dateRangePickerTests.tsx
assert.isTrue(onDateRangePickerChangeSpy.notCalled); }); it("caption options are only displayed for possible months and years", () => { const minDate = new Date(2015, 0, 5); const maxDate = new Date(2015, 0, 7); renderDateRangePicker({ minDate, maxDate }); const monthOptions = getOptionsText(DateClasses.DATEPICKER_MONTH_SELECT); const yearOptions = getOptionsText(DateClasses.DATEPICKER_YEAR_SELECT); assert.lengthOf(monthOptions, 1); assert.isTrue(monthOptions[0] === "January");
</s> remove const minDate = new Date(2015, 0, 5); const maxDate = new Date(2015, 0, 7); </s> add const minDate = new Date(2015, Months.JANUARY, 5); const maxDate = new Date(2015, Months.JANUARY, 7); </s> remove const minDate = new Date(2015, 0, 5); const maxDate = new Date(2015, 0, 7); const initialMonth = new Date(2015, 0, 12); </s> add const minDate = new Date(2015, Months.JANUARY, 5); const maxDate = new Date(2015, Months.JANUARY, 7); const initialMonth = new Date(2015, Months.JANUARY, 12); </s> remove const minDate = new Date(2015, 0, 5); const maxDate = new Date(2015, 0, 7); const initialMonth = new Date(2015, 1, 12); </s> add const minDate = new Date(2015, Months.JANUARY, 5); const maxDate = new Date(2015, Months.JANUARY, 7); const initialMonth = new Date(2015, Months.FEBRUARY, 12); </s> remove const minDate = new Date(2015, 0, 5); const maxDate = new Date(2015, 0, 7); const value = [new Date(2015, 0, 12), null] as DateRange; </s> add const minDate = new Date(2015, Months.JANUARY, 5); const maxDate = new Date(2015, Months.JANUARY, 7); const value = [new Date(2015, Months.JANUARY, 12), null] as DateRange; </s> remove const minDate = new Date(2015, 0, 5); const maxDate = new Date(2015, 0, 7); const defaultValue = [new Date(2015, 0, 12), null] as DateRange; </s> add const minDate = new Date(2015, Months.JANUARY, 5); const maxDate = new Date(2015, Months.JANUARY, 7); const defaultValue = [new Date(2015, Months.JANUARY, 12), null] as DateRange;
const minDate = new Date(2015, Months.JANUARY, 5); const maxDate = new Date(2015, Months.JANUARY, 7);
assert.isTrue(onDateRangePickerChangeSpy.notCalled); }); it("caption options are only displayed for possible months and years", () => { const minDate = new Date(2015, Months.JANUARY, 5); const maxDate = new Date(2015, Months.JANUARY, 7); const minDate = new Date(2015, Months.JANUARY, 5); const maxDate = new Date(2015, Months.JANUARY, 7); renderDateRangePicker({ minDate, maxDate }); const monthOptions = getOptionsText(DateClasses.DATEPICKER_MONTH_SELECT); const yearOptions = getOptionsText(DateClasses.DATEPICKER_YEAR_SELECT); assert.lengthOf(monthOptions, 1); assert.isTrue(monthOptions[0] === "January");
[ "keep", "keep", "keep", "keep", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
expose Months value mapping in datetime package (#439) * expose new `const enum Months` * replace all month numbers with enum values throughout code and tests * fixes #431
https://github.com/palantir/blueprint/commit/ab4f6a8587879913de2e57df0ac87ca51021ccca
packages/datetime/test/dateRangePickerTests.tsx
assert.isTrue(yearOptions[0] === "2015"); }); it("can change month down to start date with arrow button", () => { const minDate = new Date(2015, 0, 5); const initialMonth = new Date(2015, 1, 5); renderDateRangePicker({ initialMonth, minDate }); assert.strictEqual(dateRangePicker.state.displayMonth, 1); let prevBtn = document.queryAll(".DayPicker-NavButton--prev"); assert.lengthOf(prevBtn, 1);
</s> remove assert.strictEqual(dateRangePicker.state.displayMonth, 1); </s> add assert.strictEqual(dateRangePicker.state.displayMonth, Months.FEBRUARY); </s> remove assert.strictEqual(dateRangePicker.state.displayMonth, 0); </s> add assert.strictEqual(dateRangePicker.state.displayMonth, Months.JANUARY); </s> remove const minDate = new Date(2015, 0, 5); const maxDate = new Date(2015, 0, 7); const initialMonth = new Date(2015, 1, 12); </s> add const minDate = new Date(2015, Months.JANUARY, 5); const maxDate = new Date(2015, Months.JANUARY, 7); const initialMonth = new Date(2015, Months.FEBRUARY, 12); </s> remove const minDate = new Date(2015, 0, 5); const maxDate = new Date(2015, 0, 7); const initialMonth = new Date(2015, 0, 12); </s> add const minDate = new Date(2015, Months.JANUARY, 5); const maxDate = new Date(2015, Months.JANUARY, 7); const initialMonth = new Date(2015, Months.JANUARY, 12); </s> remove const minDate = new Date(2015, 0, 5); const maxDate = new Date(2015, 0, 7); </s> add const minDate = new Date(2015, Months.JANUARY, 5); const maxDate = new Date(2015, Months.JANUARY, 7);
const minDate = new Date(2015, Months.JANUARY, 5); const initialMonth = new Date(2015, Months.FEBRUARY, 5);
assert.isTrue(yearOptions[0] === "2015"); }); it("can change month down to start date with arrow button", () => { const minDate = new Date(2015, Months.JANUARY, 5); const initialMonth = new Date(2015, Months.FEBRUARY, 5); const minDate = new Date(2015, Months.JANUARY, 5); const initialMonth = new Date(2015, Months.FEBRUARY, 5); renderDateRangePicker({ initialMonth, minDate }); assert.strictEqual(dateRangePicker.state.displayMonth, 1); let prevBtn = document.queryAll(".DayPicker-NavButton--prev"); assert.lengthOf(prevBtn, 1);
[ "keep", "keep", "keep", "keep", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
expose Months value mapping in datetime package (#439) * expose new `const enum Months` * replace all month numbers with enum values throughout code and tests * fixes #431
https://github.com/palantir/blueprint/commit/ab4f6a8587879913de2e57df0ac87ca51021ccca
packages/datetime/test/dateRangePickerTests.tsx
it("can change month down to start date with arrow button", () => { const minDate = new Date(2015, 0, 5); const initialMonth = new Date(2015, 1, 5); renderDateRangePicker({ initialMonth, minDate }); assert.strictEqual(dateRangePicker.state.displayMonth, 1); let prevBtn = document.queryAll(".DayPicker-NavButton--prev"); assert.lengthOf(prevBtn, 1); TestUtils.Simulate.click(prevBtn[0]); assert.strictEqual(dateRangePicker.state.displayMonth, 0);
</s> remove const minDate = new Date(2015, 0, 5); const initialMonth = new Date(2015, 1, 5); </s> add const minDate = new Date(2015, Months.JANUARY, 5); const initialMonth = new Date(2015, Months.FEBRUARY, 5); </s> remove assert.strictEqual(dateRangePicker.state.displayMonth, 0); </s> add assert.strictEqual(dateRangePicker.state.displayMonth, Months.JANUARY); </s> remove const minDate = new Date(2015, 0, 5); const maxDate = new Date(2015, 0, 7); const initialMonth = new Date(2015, 1, 12); </s> add const minDate = new Date(2015, Months.JANUARY, 5); const maxDate = new Date(2015, Months.JANUARY, 7); const initialMonth = new Date(2015, Months.FEBRUARY, 12); </s> remove const minDate = new Date(2015, 0, 5); const maxDate = new Date(2015, 0, 7); const initialMonth = new Date(2015, 0, 12); </s> add const minDate = new Date(2015, Months.JANUARY, 5); const maxDate = new Date(2015, Months.JANUARY, 7); const initialMonth = new Date(2015, Months.JANUARY, 12); </s> remove const minDate = new Date(2015, 0, 5); const maxDate = new Date(2015, 0, 7); </s> add const minDate = new Date(2015, Months.JANUARY, 5); const maxDate = new Date(2015, Months.JANUARY, 7);
assert.strictEqual(dateRangePicker.state.displayMonth, Months.FEBRUARY);
it("can change month down to start date with arrow button", () => { const minDate = new Date(2015, 0, 5); const initialMonth = new Date(2015, 1, 5); renderDateRangePicker({ initialMonth, minDate }); assert.strictEqual(dateRangePicker.state.displayMonth, Months.FEBRUARY); let prevBtn = document.queryAll(".DayPicker-NavButton--prev"); assert.lengthOf(prevBtn, 1); TestUtils.Simulate.click(prevBtn[0]); assert.strictEqual(dateRangePicker.state.displayMonth, 0);
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
expose Months value mapping in datetime package (#439) * expose new `const enum Months` * replace all month numbers with enum values throughout code and tests * fixes #431
https://github.com/palantir/blueprint/commit/ab4f6a8587879913de2e57df0ac87ca51021ccca
packages/datetime/test/dateRangePickerTests.tsx
let prevBtn = document.queryAll(".DayPicker-NavButton--prev"); assert.lengthOf(prevBtn, 1); TestUtils.Simulate.click(prevBtn[0]); assert.strictEqual(dateRangePicker.state.displayMonth, 0); prevBtn = document.queryAll(".DayPicker-NavButton--prev"); assert.lengthOf(prevBtn, 0); }); });
</s> remove assert.strictEqual(dateRangePicker.state.displayMonth, 1); </s> add assert.strictEqual(dateRangePicker.state.displayMonth, Months.FEBRUARY); </s> remove const minDate = new Date(2015, 0, 5); const initialMonth = new Date(2015, 1, 5); </s> add const minDate = new Date(2015, Months.JANUARY, 5); const initialMonth = new Date(2015, Months.FEBRUARY, 5); </s> remove months.simulate("change", { target: { value: 2 } }); </s> add months.simulate("change", { target: { value: Months.MARCH } }); </s> remove assert.equal(dateRangePicker.state.displayMonth, 3); </s> add assert.equal(dateRangePicker.state.displayMonth, Months.APRIL); </s> remove const defaultValue = [new Date(2007, 3, 4), null] as DateRange; const initialMonth = new Date(2002, 2, 1); const maxDate = new Date(2020, 0); const minDate = new Date(2000, 0); </s> add const defaultValue = [new Date(2007, Months.APRIL, 4), null] as DateRange; const initialMonth = new Date(2002, Months.MARCH, 1); const maxDate = new Date(2020, Months.JANUARY); const minDate = new Date(2000, Months.JANUARY);
assert.strictEqual(dateRangePicker.state.displayMonth, Months.JANUARY);
let prevBtn = document.queryAll(".DayPicker-NavButton--prev"); assert.lengthOf(prevBtn, 1); TestUtils.Simulate.click(prevBtn[0]); assert.strictEqual(dateRangePicker.state.displayMonth, Months.JANUARY); prevBtn = document.queryAll(".DayPicker-NavButton--prev"); assert.lengthOf(prevBtn, 0); }); });
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
expose Months value mapping in datetime package (#439) * expose new `const enum Months` * replace all month numbers with enum values throughout code and tests * fixes #431
https://github.com/palantir/blueprint/commit/ab4f6a8587879913de2e57df0ac87ca51021ccca
packages/datetime/test/dateRangePickerTests.tsx
}); describe("when controlled", () => { it("value initially selects a day", () => { const defaultValue = [new Date(2010, 1, 2), null] as DateRange; const value = [new Date(2010, 0, 1), null] as DateRange; renderDateRangePicker({ defaultValue, value }); const selectedDays = getSelectedDayElements(); assert.lengthOf(selectedDays, 1); assert.equal(selectedDays[0].textContent, value[0].getDate()); });
</s> remove const value = new Date(2010, 0, 1); </s> add const value = new Date(2010, Months.JANUARY, 1); </s> remove <DatePicker defaultValue={new Date(2010, 1, 2)} value={value} />, </s> add <DatePicker defaultValue={new Date(2010, Months.FEBRUARY, 2)} value={value} />, </s> remove const minDate = new Date(2015, 0, 5); const maxDate = new Date(2015, 0, 7); const defaultValue = [new Date(2015, 0, 12), null] as DateRange; </s> add const minDate = new Date(2015, Months.JANUARY, 5); const maxDate = new Date(2015, Months.JANUARY, 7); const defaultValue = [new Date(2015, Months.JANUARY, 12), null] as DateRange; </s> remove const minDate = new Date(2015, 0, 5); const maxDate = new Date(2015, 0, 7); const value = [new Date(2015, 0, 12), null] as DateRange; </s> add const minDate = new Date(2015, Months.JANUARY, 5); const maxDate = new Date(2015, Months.JANUARY, 7); const value = [new Date(2015, Months.JANUARY, 12), null] as DateRange; </s> remove const defaultValue = [new Date(2007, 3, 4), null] as DateRange; const maxDate = new Date(2020, 0); const minDate = new Date(2000, 0); </s> add const defaultValue = [new Date(2007, Months.APRIL, 4), null] as DateRange; const maxDate = new Date(2020, Months.JANUARY); const minDate = new Date(2000, Months.JANUARY);
const defaultValue = [new Date(2010, Months.FEBRUARY, 2), null] as DateRange; const value = [new Date(2010, Months.JANUARY, 1), null] as DateRange;
}); describe("when controlled", () => { it("value initially selects a day", () => { const defaultValue = [new Date(2010, Months.FEBRUARY, 2), null] as DateRange; const value = [new Date(2010, Months.JANUARY, 1), null] as DateRange; const defaultValue = [new Date(2010, Months.FEBRUARY, 2), null] as DateRange; const value = [new Date(2010, Months.JANUARY, 1), null] as DateRange; renderDateRangePicker({ defaultValue, value }); const selectedDays = getSelectedDayElements(); assert.lengthOf(selectedDays, 1); assert.equal(selectedDays[0].textContent, value[0].getDate()); });
[ "keep", "keep", "keep", "keep", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
expose Months value mapping in datetime package (#439) * expose new `const enum Months` * replace all month numbers with enum values throughout code and tests * fixes #431
https://github.com/palantir/blueprint/commit/ab4f6a8587879913de2e57df0ac87ca51021ccca
packages/datetime/test/dateRangePickerTests.tsx
assert.lengthOf(getSelectedDayElements(), 0); }); it("can change displayed date with the dropdowns in the caption", () => { renderDateRangePicker({ initialMonth: new Date(2015, 2, 2), value: [null, null] }); assert.equal(dateRangePicker.state.displayMonth, 2); assert.equal(dateRangePicker.state.displayYear, 2015); TestUtils.Simulate.change(getMonthSelect(), { target: { value: 0 } } as any); TestUtils.Simulate.change(getYearSelect(), { target: { value: 2014 } } as any); assert.equal(dateRangePicker.state.displayMonth, 0);
</s> remove const { months, root, years } = wrap(<DatePicker initialMonth={new Date(2015, 2, 2)} />); assert.equal(root.state("displayMonth"), 2); </s> add const { months, root, years } = wrap(<DatePicker initialMonth={new Date(2015, Months.MARCH, 2)} />); assert.equal(root.state("displayMonth"), Months.MARCH); </s> remove const { months, root, years } = wrap(<DatePicker initialMonth={new Date(2015, 2, 2)} value={null} />); assert.equal(root.state("displayMonth"), 2); </s> add const { months, root, years } = wrap( <DatePicker initialMonth={new Date(2015, Months.MARCH, 2)} value={null} />); assert.equal(root.state("displayMonth"), Months.MARCH); </s> remove months.simulate("change", { target: { value: 5 } }); </s> add months.simulate("change", { target: { value: Months.JUNE } }); </s> remove months.simulate("change", { target: { value: 0 } }); </s> add months.simulate("change", { target: { value: Months.JANUARY } }); </s> remove months.simulate("change", { target: { value: 0 } }); </s> add months.simulate("change", { target: { value: Months.JANUARY } });
renderDateRangePicker({ initialMonth: new Date(2015, Months.MARCH, 2), value: [null, null] }); assert.equal(dateRangePicker.state.displayMonth, Months.MARCH);
assert.lengthOf(getSelectedDayElements(), 0); }); it("can change displayed date with the dropdowns in the caption", () => { renderDateRangePicker({ initialMonth: new Date(2015, Months.MARCH, 2), value: [null, null] }); assert.equal(dateRangePicker.state.displayMonth, Months.MARCH); renderDateRangePicker({ initialMonth: new Date(2015, Months.MARCH, 2), value: [null, null] }); assert.equal(dateRangePicker.state.displayMonth, Months.MARCH); assert.equal(dateRangePicker.state.displayYear, 2015); TestUtils.Simulate.change(getMonthSelect(), { target: { value: 0 } } as any); TestUtils.Simulate.change(getYearSelect(), { target: { value: 2014 } } as any); assert.equal(dateRangePicker.state.displayMonth, 0);
[ "keep", "keep", "keep", "keep", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
expose Months value mapping in datetime package (#439) * expose new `const enum Months` * replace all month numbers with enum values throughout code and tests * fixes #431
https://github.com/palantir/blueprint/commit/ab4f6a8587879913de2e57df0ac87ca51021ccca
packages/datetime/test/dateRangePickerTests.tsx
// Buttons $pt-button-height: $pt-grid-size * 3 !default; $pt-button-height-large: $pt-grid-size * 4 !default; // Inputs $pt-input-height: $pt-grid-size * 3 !default; $pt-input-height-large: $pt-grid-size * 4 !default;
</s>
$pt-button-height-small: $pt-grid-size * 2.4 !default;
// Buttons $pt-button-height: $pt-grid-size * 3 !default; $pt-button-height-small: $pt-grid-size * 2.4 !default; $pt-button-height-large: $pt-grid-size * 4 !default; // Inputs $pt-input-height: $pt-grid-size * 3 !default; $pt-input-height-large: $pt-grid-size * 4 !default;
[ "keep", "keep", "add", "keep", "keep", "keep", "keep", "keep" ]
[Button] Support for small buttons (#932) * Small buttons at 24px height * Remove support for icons in small buttons * Add comment about why icons are hidden * Add support for button groups * Remove small buttons from button group example because blurry icons
https://github.com/palantir/blueprint/commit/ab7de86891613bd688f053db5835e2922da43f4b
packages/core/src/common/_variables.scss
.pt-intent-warning - Warning intent .pt-intent-danger - Danger intent .pt-active - Active appearance .pt-large - Larger size .pt-fill - Fill parent container Styleguide pt-button */ .pt-button {
</s>
.pt-small - Smaller size. Note that small buttons do not support icons.
.pt-intent-warning - Warning intent .pt-intent-danger - Danger intent .pt-active - Active appearance .pt-large - Larger size .pt-small - Smaller size. Note that small buttons do not support icons. .pt-fill - Fill parent container Styleguide pt-button */ .pt-button {
[ "keep", "keep", "keep", "add", "keep", "keep", "keep", "keep", "keep" ]
[Button] Support for small buttons (#932) * Small buttons at 24px height * Remove support for icons in small buttons * Add comment about why icons are hidden * Add support for button groups * Remove small buttons from button group example because blurry icons
https://github.com/palantir/blueprint/commit/ab7de86891613bd688f053db5835e2922da43f4b
packages/core/src/components/button/_button.scss
} // ensure icon button with no text is a perfect square &[class*="pt-icon-"]:empty { padding: 0; &::before {
</s>
&.pt-small, .pt-small & { @include pt-button-small(); // small buttons are too small to contain any Blueprint icons &[class*="pt-icon-"]::before, #{$icon-classes} { display: none; } }
} &.pt-small, .pt-small & { @include pt-button-small(); // small buttons are too small to contain any Blueprint icons &[class*="pt-icon-"]::before, #{$icon-classes} { display: none; } } // ensure icon button with no text is a perfect square &[class*="pt-icon-"]:empty { padding: 0; &::before {
[ "keep", "add", "keep", "keep", "keep", "keep", "keep" ]
[Button] Support for small buttons (#932) * Small buttons at 24px height * Remove support for icons in small buttons * Add comment about why icons are hidden * Add support for button groups * Remove small buttons from button group example because blurry icons
https://github.com/palantir/blueprint/commit/ab7de86891613bd688f053db5835e2922da43f4b
packages/core/src/components/button/_button.scss
$button-border-width: 1px !default; $button-padding: 0 $pt-grid-size !default; $button-padding-large: 0 ($pt-grid-size * 1.5) !default; $button-icon-spacing: ($pt-button-height - $pt-icon-size-standard) / 2 !default; $button-icon-spacing-large: ($pt-button-height-large - $pt-icon-size-large) / 2 !default; /*
</s>
$button-padding-small: 0 ($pt-grid-size * 0.7) !default;
$button-border-width: 1px !default; $button-padding: 0 $pt-grid-size !default; $button-padding-small: 0 ($pt-grid-size * 0.7) !default; $button-padding-large: 0 ($pt-grid-size * 1.5) !default; $button-icon-spacing: ($pt-button-height - $pt-icon-size-standard) / 2 !default; $button-icon-spacing-large: ($pt-button-height-large - $pt-icon-size-large) / 2 !default; /*
[ "keep", "add", "keep", "keep", "keep", "keep", "keep" ]
[Button] Support for small buttons (#932) * Small buttons at 24px height * Remove support for icons in small buttons * Add comment about why icons are hidden * Add support for button groups * Remove small buttons from button group example because blurry icons
https://github.com/palantir/blueprint/commit/ab7de86891613bd688f053db5835e2922da43f4b
packages/core/src/components/button/_common.scss
{ "name": "@blueprintjs/core", "version": "3.19.1", "description": "Core styles & components", "main": "lib/cjs/index.js", "module": "lib/esm/index.js", "esnext": "lib/esnext/index.js", "typings": "lib/esm/index.d.ts",
</s> remove "version": "3.8.1", </s> add "version": "3.8.2", </s> remove "version": "3.14.0", </s> add "version": "3.15.0", </s> remove "version": "3.11.1", </s> add "version": "3.11.2", </s> remove "version": "3.11.0", </s> add "version": "3.12.0", </s> remove "version": "0.10.0", </s> add "version": "0.10.1",
"version": "3.20.0",
{ "name": "@blueprintjs/core", "version": "3.20.0", "description": "Core styles & components", "main": "lib/cjs/index.js", "module": "lib/esm/index.js", "esnext": "lib/esnext/index.js", "typings": "lib/esm/index.d.ts",
[ "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
Publish - @blueprintjs/[email protected] - @blueprintjs/[email protected] - @blueprintjs/[email protected] - @blueprintjs/[email protected] - @blueprintjs/[email protected] - @blueprintjs/[email protected] - @blueprintjs/[email protected]
https://github.com/palantir/blueprint/commit/abcfe1d450be522c0a0d469ab751b99f5776a2e1
packages/core/package.json
"test:karma:debug": "karma start --single-run=false --reporters=mocha --debug", "verify": "npm-run-all compile -p dist test lint" }, "dependencies": { "@blueprintjs/icons": "^3.11.0", "@types/dom4": "^2.0.1", "classnames": "^2.2", "dom4": "^2.1.5", "normalize.css": "^8.0.1", "popper.js": "^1.15.0",
</s> remove "@blueprintjs/core": "^3.19.0", </s> add "@blueprintjs/core": "^3.20.0", </s> remove "@blueprintjs/core": "^3.19.1", </s> add "@blueprintjs/core": "^3.20.0", </s> remove "@blueprintjs/core": "^3.19.0", </s> add "@blueprintjs/core": "^3.20.0", </s> remove "@blueprintjs/icons": "^3.11.0", "@blueprintjs/select": "^3.11.0", "@blueprintjs/table": "^3.8.0", "@blueprintjs/test-commons": "^0.10.0", </s> add "@blueprintjs/icons": "^3.12.0", "@blueprintjs/select": "^3.11.2", "@blueprintjs/table": "^3.8.2", "@blueprintjs/test-commons": "^0.10.1", </s> remove "@blueprintjs/core": "^3.19.0", "@blueprintjs/datetime": "^3.14.0", </s> add "@blueprintjs/core": "^3.20.0", "@blueprintjs/datetime": "^3.15.0",
"@blueprintjs/icons": "^3.12.0",
"test:karma:debug": "karma start --single-run=false --reporters=mocha --debug", "verify": "npm-run-all compile -p dist test lint" }, "dependencies": { "@blueprintjs/icons": "^3.12.0", "@types/dom4": "^2.0.1", "classnames": "^2.2", "dom4": "^2.1.5", "normalize.css": "^8.0.1", "popper.js": "^1.15.0",
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
Publish - @blueprintjs/[email protected] - @blueprintjs/[email protected] - @blueprintjs/[email protected] - @blueprintjs/[email protected] - @blueprintjs/[email protected] - @blueprintjs/[email protected] - @blueprintjs/[email protected]
https://github.com/palantir/blueprint/commit/abcfe1d450be522c0a0d469ab751b99f5776a2e1
packages/core/package.json
}, "devDependencies": { "@blueprintjs/karma-build-scripts": "^0.12.0", "@blueprintjs/node-build-scripts": "^0.11.0", "@blueprintjs/test-commons": "^0.10.0", "enzyme": "^3.10.0", "karma": "^4.2.0", "mocha": "^6.2.0", "npm-run-all": "^4.1.5", "react": "^16.8.6",
</s> remove "@blueprintjs/test-commons": "^0.10.0", </s> add "@blueprintjs/test-commons": "^0.10.1", </s> remove "@blueprintjs/test-commons": "^0.10.0", </s> add "@blueprintjs/test-commons": "^0.10.1", </s> remove "@blueprintjs/test-commons": "^0.10.0", </s> add "@blueprintjs/test-commons": "^0.10.1", </s> remove "@blueprintjs/core": "^3.19.0", </s> add "@blueprintjs/core": "^3.20.0", </s> remove "@blueprintjs/icons": "^3.11.0", "@blueprintjs/select": "^3.11.0", "@blueprintjs/table": "^3.8.0", "@blueprintjs/test-commons": "^0.10.0", </s> add "@blueprintjs/icons": "^3.12.0", "@blueprintjs/select": "^3.11.2", "@blueprintjs/table": "^3.8.2", "@blueprintjs/test-commons": "^0.10.1",
"@blueprintjs/test-commons": "^0.10.1",
}, "devDependencies": { "@blueprintjs/karma-build-scripts": "^0.12.0", "@blueprintjs/node-build-scripts": "^0.11.0", "@blueprintjs/test-commons": "^0.10.1", "enzyme": "^3.10.0", "karma": "^4.2.0", "mocha": "^6.2.0", "npm-run-all": "^4.1.5", "react": "^16.8.6",
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
Publish - @blueprintjs/[email protected] - @blueprintjs/[email protected] - @blueprintjs/[email protected] - @blueprintjs/[email protected] - @blueprintjs/[email protected] - @blueprintjs/[email protected] - @blueprintjs/[email protected]
https://github.com/palantir/blueprint/commit/abcfe1d450be522c0a0d469ab751b99f5776a2e1
packages/core/package.json
{ "name": "@blueprintjs/datetime", "version": "3.14.0", "description": "Components for interacting with dates and times", "main": "lib/cjs/index.js", "module": "lib/esm/index.js", "esnext": "lib/esnext/index.js", "typings": "lib/esm/index.d.ts",
</s> remove "version": "3.11.0", </s> add "version": "3.12.0", </s> remove "version": "3.11.1", </s> add "version": "3.11.2", </s> remove "version": "3.19.1", </s> add "version": "3.20.0", </s> remove "version": "3.8.1", </s> add "version": "3.8.2", </s> remove "version": "0.10.0", </s> add "version": "0.10.1",
"version": "3.15.0",
{ "name": "@blueprintjs/datetime", "version": "3.15.0", "description": "Components for interacting with dates and times", "main": "lib/cjs/index.js", "module": "lib/esm/index.js", "esnext": "lib/esnext/index.js", "typings": "lib/esm/index.d.ts",
[ "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
Publish - @blueprintjs/[email protected] - @blueprintjs/[email protected] - @blueprintjs/[email protected] - @blueprintjs/[email protected] - @blueprintjs/[email protected] - @blueprintjs/[email protected] - @blueprintjs/[email protected]
https://github.com/palantir/blueprint/commit/abcfe1d450be522c0a0d469ab751b99f5776a2e1
packages/datetime/package.json
"test:karma:debug": "karma start --single-run=false --reporters=mocha --debug", "verify": "npm-run-all compile -p dist test lint" }, "dependencies": { "@blueprintjs/core": "^3.19.0", "classnames": "^2.2", "react-day-picker": "^7.3.2", "tslib": "~1.9.0" }, "peerDependencies": {
</s> remove "@blueprintjs/core": "^3.19.0", </s> add "@blueprintjs/core": "^3.20.0", </s> remove "@blueprintjs/core": "^3.19.1", </s> add "@blueprintjs/core": "^3.20.0", </s> remove "@blueprintjs/icons": "^3.11.0", </s> add "@blueprintjs/icons": "^3.12.0", </s> remove "@blueprintjs/core": "^3.19.0", "@blueprintjs/datetime": "^3.14.0", </s> add "@blueprintjs/core": "^3.20.0", "@blueprintjs/datetime": "^3.15.0", </s> remove "@blueprintjs/test-commons": "^0.10.0", </s> add "@blueprintjs/test-commons": "^0.10.1",
"@blueprintjs/core": "^3.20.0",
"test:karma:debug": "karma start --single-run=false --reporters=mocha --debug", "verify": "npm-run-all compile -p dist test lint" }, "dependencies": { "@blueprintjs/core": "^3.20.0", "classnames": "^2.2", "react-day-picker": "^7.3.2", "tslib": "~1.9.0" }, "peerDependencies": {
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
Publish - @blueprintjs/[email protected] - @blueprintjs/[email protected] - @blueprintjs/[email protected] - @blueprintjs/[email protected] - @blueprintjs/[email protected] - @blueprintjs/[email protected] - @blueprintjs/[email protected]
https://github.com/palantir/blueprint/commit/abcfe1d450be522c0a0d469ab751b99f5776a2e1
packages/datetime/package.json
}, "devDependencies": { "@blueprintjs/karma-build-scripts": "^0.12.0", "@blueprintjs/node-build-scripts": "^0.11.0", "@blueprintjs/test-commons": "^0.10.0", "enzyme": "^3.10.0", "karma": "^4.2.0", "mocha": "^6.2.0", "npm-run-all": "^4.1.5", "react": "^16.8.6",
</s>
"@blueprintjs/test-commons": "^0.10.1",
}, "devDependencies": { "@blueprintjs/karma-build-scripts": "^0.12.0", "@blueprintjs/node-build-scripts": "^0.11.0", "@blueprintjs/test-commons": "^0.10.1", "enzyme": "^3.10.0", "karma": "^4.2.0", "mocha": "^6.2.0", "npm-run-all": "^4.1.5", "react": "^16.8.6",
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
Publish - @blueprintjs/[email protected] - @blueprintjs/[email protected] - @blueprintjs/[email protected] - @blueprintjs/[email protected] - @blueprintjs/[email protected] - @blueprintjs/[email protected] - @blueprintjs/[email protected]
https://github.com/palantir/blueprint/commit/abcfe1d450be522c0a0d469ab751b99f5776a2e1
packages/datetime/package.json
{ "name": "@blueprintjs/docs-app", "version": "3.19.0", "description": "Blueprint Documentation Site", "private": true, "scripts": { "bundle": "webpack --config ./webpack.config.js", "clean": "rm -rf dist/*",
</s> remove "version": "0.10.0", </s> add "version": "0.10.1", </s> remove "version": "3.8.1", </s> add "version": "3.8.2", </s> remove "version": "3.19.1", </s> add "version": "3.20.0", </s> remove "version": "3.14.0", </s> add "version": "3.15.0", </s> remove "version": "3.11.1", </s> add "version": "3.11.2",
"version": "3.20.0",
{ "name": "@blueprintjs/docs-app", "version": "3.20.0", "description": "Blueprint Documentation Site", "private": true, "scripts": { "bundle": "webpack --config ./webpack.config.js", "clean": "rm -rf dist/*",
[ "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
Publish - @blueprintjs/[email protected] - @blueprintjs/[email protected] - @blueprintjs/[email protected] - @blueprintjs/[email protected] - @blueprintjs/[email protected] - @blueprintjs/[email protected] - @blueprintjs/[email protected]
https://github.com/palantir/blueprint/commit/abcfe1d450be522c0a0d469ab751b99f5776a2e1
packages/docs-app/package.json
"test": "exit 0", "verify": "run-p dist lint" }, "dependencies": { "@blueprintjs/core": "^3.19.0", "@blueprintjs/datetime": "^3.14.0", "@blueprintjs/docs-data": "^3.16.0", "@blueprintjs/docs-theme": "^3.4.0", "@blueprintjs/icons": "^3.11.0", "@blueprintjs/select": "^3.11.0", "@blueprintjs/table": "^3.8.0",
</s> remove "@blueprintjs/icons": "^3.11.0", "@blueprintjs/select": "^3.11.0", "@blueprintjs/table": "^3.8.0", "@blueprintjs/test-commons": "^0.10.0", </s> add "@blueprintjs/icons": "^3.12.0", "@blueprintjs/select": "^3.11.2", "@blueprintjs/table": "^3.8.2", "@blueprintjs/test-commons": "^0.10.1", </s> remove "@blueprintjs/icons": "^3.11.0", </s> add "@blueprintjs/icons": "^3.12.0", </s> remove "@blueprintjs/core": "^3.19.0", </s> add "@blueprintjs/core": "^3.20.0", </s> remove "@blueprintjs/core": "^3.19.0", </s> add "@blueprintjs/core": "^3.20.0", </s> remove "@blueprintjs/core": "^3.19.1", </s> add "@blueprintjs/core": "^3.20.0",
"@blueprintjs/core": "^3.20.0", "@blueprintjs/datetime": "^3.15.0",
"test": "exit 0", "verify": "run-p dist lint" }, "dependencies": { "@blueprintjs/core": "^3.20.0", "@blueprintjs/datetime": "^3.15.0", "@blueprintjs/core": "^3.20.0", "@blueprintjs/datetime": "^3.15.0", "@blueprintjs/docs-data": "^3.16.0", "@blueprintjs/docs-theme": "^3.4.0", "@blueprintjs/icons": "^3.11.0", "@blueprintjs/select": "^3.11.0", "@blueprintjs/table": "^3.8.0",
[ "keep", "keep", "keep", "keep", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
Publish - @blueprintjs/[email protected] - @blueprintjs/[email protected] - @blueprintjs/[email protected] - @blueprintjs/[email protected] - @blueprintjs/[email protected] - @blueprintjs/[email protected] - @blueprintjs/[email protected]
https://github.com/palantir/blueprint/commit/abcfe1d450be522c0a0d469ab751b99f5776a2e1
packages/docs-app/package.json