@contentful/field-editor-date 1.6.1 → 1.6.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@contentful/field-editor-date",
3
- "version": "1.6.1",
3
+ "version": "1.6.2",
4
4
  "main": "dist/cjs/index.js",
5
5
  "module": "dist/esm/index.js",
6
6
  "types": "dist/types/index.d.ts",
@@ -38,18 +38,18 @@
38
38
  "dependencies": {
39
39
  "@contentful/f36-components": "^4.34.1",
40
40
  "@contentful/f36-tokens": "^4.0.1",
41
- "@contentful/field-editor-shared": "^1.4.1",
41
+ "@contentful/field-editor-shared": "^1.4.2",
42
42
  "emotion": "^10.0.17",
43
43
  "moment": "^2.20.0"
44
44
  },
45
45
  "devDependencies": {
46
46
  "@babel/core": "^7.7.4",
47
- "@contentful/field-editor-test-utils": "^1.4.2",
47
+ "@contentful/field-editor-test-utils": "^1.4.3",
48
48
  "@types/timezoned-date": "^3.0.0",
49
49
  "timezoned-date": "^3.0.2"
50
50
  },
51
51
  "peerDependencies": {
52
52
  "react": ">=16.8.0"
53
53
  },
54
- "gitHead": "0fc8da4aa8ad8603c3adf4bd77b26ba46de11e33"
54
+ "gitHead": "ef0adb263ad287e6f78888a05727d0f2f4f8968d"
55
55
  }
@@ -1,110 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", {
3
- value: true
4
- });
5
- const _react = _interop_require_wildcard(require("react"));
6
- require("@testing-library/jest-dom/extend-expect");
7
- const _react1 = require("@testing-library/react");
8
- const _timezoneddate = _interop_require_default(require("timezoned-date"));
9
- const _DatepickerInput = require("./DatepickerInput");
10
- const _date = require("./utils/date");
11
- function _interop_require_default(obj) {
12
- return obj && obj.__esModule ? obj : {
13
- default: obj
14
- };
15
- }
16
- function _getRequireWildcardCache(nodeInterop) {
17
- if (typeof WeakMap !== "function") return null;
18
- var cacheBabelInterop = new WeakMap();
19
- var cacheNodeInterop = new WeakMap();
20
- return (_getRequireWildcardCache = function(nodeInterop) {
21
- return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
22
- })(nodeInterop);
23
- }
24
- function _interop_require_wildcard(obj, nodeInterop) {
25
- if (!nodeInterop && obj && obj.__esModule) {
26
- return obj;
27
- }
28
- if (obj === null || typeof obj !== "object" && typeof obj !== "function") {
29
- return {
30
- default: obj
31
- };
32
- }
33
- var cache = _getRequireWildcardCache(nodeInterop);
34
- if (cache && cache.has(obj)) {
35
- return cache.get(obj);
36
- }
37
- var newObj = {};
38
- var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
39
- for(var key in obj){
40
- if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
41
- var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
42
- if (desc && (desc.get || desc.set)) {
43
- Object.defineProperty(newObj, key, desc);
44
- } else {
45
- newObj[key] = obj[key];
46
- }
47
- }
48
- }
49
- newObj.default = obj;
50
- if (cache) {
51
- cache.set(obj, newObj);
52
- }
53
- return newObj;
54
- }
55
- (0, _react1.configure)({
56
- testIdAttribute: 'data-test-id'
57
- });
58
- let originalDate;
59
- beforeEach(()=>{
60
- originalDate = global.Date;
61
- });
62
- afterEach(()=>{
63
- global.Date = originalDate;
64
- });
65
- const renderDatepicker = (dateString)=>{
66
- const { date } = (0, _date.userInputFromDatetime)({
67
- value: dateString,
68
- uses12hClock: false
69
- });
70
- return (0, _react1.render)(_react.createElement(_DatepickerInput.DatepickerInput, {
71
- value: date,
72
- onChange: jest.fn()
73
- }));
74
- };
75
- describe('Date: DatepickerInput', function() {
76
- describe('renders correct date, when the system UTC offset is +02:00 and the one in the props.value is', ()=>{
77
- it('+04:00', async ()=>{
78
- global.Date = _timezoneddate.default.makeConstructor(120);
79
- renderDatepicker('2022-09-22T00:00+04:00');
80
- expect(_react1.screen.getByTestId('cf-ui-datepicker-input')).toHaveValue('22 Sep 2022');
81
- });
82
- it('+10:00', async ()=>{
83
- global.Date = _timezoneddate.default.makeConstructor(120);
84
- renderDatepicker('2022-09-22T00:00+10:00');
85
- expect(_react1.screen.getByTestId('cf-ui-datepicker-input')).toHaveValue('22 Sep 2022');
86
- });
87
- it('-08:00', async ()=>{
88
- global.Date = _timezoneddate.default.makeConstructor(120);
89
- renderDatepicker('2022-09-22T00:00-08:00');
90
- expect(_react1.screen.getByTestId('cf-ui-datepicker-input')).toHaveValue('22 Sep 2022');
91
- });
92
- });
93
- describe('renders correct date, when the system UTC offset is -06:00 and the one in the props.value is', ()=>{
94
- it('+02:00', async ()=>{
95
- global.Date = _timezoneddate.default.makeConstructor(-360);
96
- renderDatepicker('2022-09-22T00:00+02:00');
97
- expect(_react1.screen.getByTestId('cf-ui-datepicker-input')).toHaveValue('22 Sep 2022');
98
- });
99
- it('+10:00', async ()=>{
100
- global.Date = _timezoneddate.default.makeConstructor(-360);
101
- renderDatepicker('2022-09-22T00:00+10:00');
102
- expect(_react1.screen.getByTestId('cf-ui-datepicker-input')).toHaveValue('22 Sep 2022');
103
- });
104
- it('-08:00', async ()=>{
105
- global.Date = _timezoneddate.default.makeConstructor(-360);
106
- renderDatepicker('2022-09-22T00:00-08:00');
107
- expect(_react1.screen.getByTestId('cf-ui-datepicker-input')).toHaveValue('22 Sep 2022');
108
- });
109
- });
110
- });
@@ -1,62 +0,0 @@
1
- import * as React from 'react';
2
- import '@testing-library/jest-dom/extend-expect';
3
- import { configure, render, screen } from '@testing-library/react';
4
- import timezonedDate from 'timezoned-date';
5
- import { DatepickerInput } from './DatepickerInput';
6
- import { userInputFromDatetime } from './utils/date';
7
- configure({
8
- testIdAttribute: 'data-test-id'
9
- });
10
- let originalDate;
11
- beforeEach(()=>{
12
- originalDate = global.Date;
13
- });
14
- afterEach(()=>{
15
- global.Date = originalDate;
16
- });
17
- const renderDatepicker = (dateString)=>{
18
- const { date } = userInputFromDatetime({
19
- value: dateString,
20
- uses12hClock: false
21
- });
22
- return render(React.createElement(DatepickerInput, {
23
- value: date,
24
- onChange: jest.fn()
25
- }));
26
- };
27
- describe('Date: DatepickerInput', function() {
28
- describe('renders correct date, when the system UTC offset is +02:00 and the one in the props.value is', ()=>{
29
- it('+04:00', async ()=>{
30
- global.Date = timezonedDate.makeConstructor(120);
31
- renderDatepicker('2022-09-22T00:00+04:00');
32
- expect(screen.getByTestId('cf-ui-datepicker-input')).toHaveValue('22 Sep 2022');
33
- });
34
- it('+10:00', async ()=>{
35
- global.Date = timezonedDate.makeConstructor(120);
36
- renderDatepicker('2022-09-22T00:00+10:00');
37
- expect(screen.getByTestId('cf-ui-datepicker-input')).toHaveValue('22 Sep 2022');
38
- });
39
- it('-08:00', async ()=>{
40
- global.Date = timezonedDate.makeConstructor(120);
41
- renderDatepicker('2022-09-22T00:00-08:00');
42
- expect(screen.getByTestId('cf-ui-datepicker-input')).toHaveValue('22 Sep 2022');
43
- });
44
- });
45
- describe('renders correct date, when the system UTC offset is -06:00 and the one in the props.value is', ()=>{
46
- it('+02:00', async ()=>{
47
- global.Date = timezonedDate.makeConstructor(-360);
48
- renderDatepicker('2022-09-22T00:00+02:00');
49
- expect(screen.getByTestId('cf-ui-datepicker-input')).toHaveValue('22 Sep 2022');
50
- });
51
- it('+10:00', async ()=>{
52
- global.Date = timezonedDate.makeConstructor(-360);
53
- renderDatepicker('2022-09-22T00:00+10:00');
54
- expect(screen.getByTestId('cf-ui-datepicker-input')).toHaveValue('22 Sep 2022');
55
- });
56
- it('-08:00', async ()=>{
57
- global.Date = timezonedDate.makeConstructor(-360);
58
- renderDatepicker('2022-09-22T00:00-08:00');
59
- expect(screen.getByTestId('cf-ui-datepicker-input')).toHaveValue('22 Sep 2022');
60
- });
61
- });
62
- });
@@ -1 +0,0 @@
1
- import '@testing-library/jest-dom/extend-expect';