@dotss/tictoccroc 0.0.4 → 0.0.6
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/dist/index.mjs +78 -77
- package/dist/shared/components/MediaDialog/MediaDialogFooter/MediaDialogFooter.mjs +1 -1
- package/dist/shared/components/Roller/Roller.mjs +131 -7
- package/dist/shared/components/Roller/index.mjs +3 -3
- package/dist/shared/components/index.mjs +3 -3
- package/dist/teacher/profile/components/ActivityGallery/ActivityGallery.mjs +23 -24
- package/dist/teacher/profile/components/ActivityGallery/ActivityGalleryItem/ActivityGalleryItem.d.ts +2 -2
- package/dist/teacher/profile/components/ActivityGallery/ActivityGalleryItem/ActivityGalleryItem.mjs +3 -3
- package/dist/teacher/profile/components/CareerSection/CareerItem/CareerItem.d.ts +5 -2
- package/dist/teacher/profile/components/CareerSection/CareerItem/CareerItem.mjs +24 -24
- package/dist/teacher/profile/components/CareerSection/CareerSection.mjs +42 -41
- package/dist/teacher/profile/components/CertificationSection/CertificationItem/CertificationItem.d.ts +5 -2
- package/dist/teacher/profile/components/CertificationSection/CertificationItem/CertificationItem.mjs +28 -23
- package/dist/teacher/profile/components/CertificationSection/CertificationSection.mjs +41 -37
- package/dist/teacher/profile/components/EducationSection/EducationItem/EducationItem.d.ts +6 -3
- package/dist/teacher/profile/components/EducationSection/EducationItem/EducationItem.mjs +38 -30
- package/dist/teacher/profile/components/EducationSection/EducationSection.mjs +35 -34
- package/dist/teacher/profile/components/LessonNotesSection/LessonNotesSection.mjs +79 -6
- package/dist/teacher/profile/components/LessonNotesSection/index.mjs +3 -3
- package/dist/teacher/profile/components/index.mjs +5 -5
- package/dist/teacher/profile/utils/index.d.ts +1 -0
- package/dist/teacher/profile/utils/index.mjs +5 -0
- package/dist/teacher/profile/utils/sortItems/index.d.ts +3 -0
- package/dist/teacher/profile/utils/sortItems/index.mjs +6 -0
- package/dist/teacher/profile/utils/sortItems/sortItems.d.ts +9 -0
- package/dist/teacher/profile/utils/sortItems/sortItems.mjs +29 -0
- package/package.json +10 -2
- package/dist/LessonNotesSection-Bg1DHFxg.js +0 -208
- package/dist/shared/utils/birthDateToAge/birthDateToAge.test.mjs +0 -11
- package/dist/shared/utils/getDateRange/getDateRange.test.mjs +0 -60
- package/dist/shared/utils/getImageUrl/getImageUrl.test.mjs +0 -27
- package/dist/shared/utils/getTimeRange/getTimeRange.test.mjs +0 -75
- package/dist/shared/utils/getVimeoId/getVimeoId.test.mjs +0 -14
- package/dist/shared/utils/isAndroid/isAndroid.test.mjs +0 -12
- package/dist/shared/utils/isApp/isApp.test.mjs +0 -22
- package/dist/shared/utils/isDesktop/isDesktop.test.mjs +0 -10
- package/dist/shared/utils/isServer/isServer.test.mjs +0 -12
- package/dist/shared/utils/objectToQueryString/objectToQueryString.test.mjs +0 -11
- package/dist/shared/utils/parseQueryString/parseQueryString.test.mjs +0 -15
- package/dist/shared/utils/share/share.test.mjs +0 -31
|
@@ -1,208 +0,0 @@
|
|
|
1
|
-
import { jsx as u, jsxs as m } from "react/jsx-runtime";
|
|
2
|
-
import { useState as N, useRef as c, Children as A, isValidElement as $, useEffect as x, cloneElement as X, forwardRef as j } from "react";
|
|
3
|
-
import { Flexbox as d, Typography as w, Button as B, Icon as P } from "@dotss/ui";
|
|
4
|
-
import U from "@dotss/ui/core/useTheme";
|
|
5
|
-
import z from "./shared/components/Roller/RollerBlock/RollerBlock.mjs";
|
|
6
|
-
import q from "./teacher/profile/components/LessonNotesSection/LessonNote/LessonNote.mjs";
|
|
7
|
-
function W({
|
|
8
|
-
children: f,
|
|
9
|
-
spacing: g = 2,
|
|
10
|
-
edgeSpacing: i = 4,
|
|
11
|
-
rowCount: n = 1,
|
|
12
|
-
inlineCSS: b,
|
|
13
|
-
...v
|
|
14
|
-
}) {
|
|
15
|
-
const [s, h] = N(0), o = c(null), L = c(!1), p = c(!0), R = c(0), y = c(0), l = c(0), S = A.toArray(f).filter($).filter((e) => e.type === z || e.type === q), k = S.length, C = (e) => {
|
|
16
|
-
var r, t;
|
|
17
|
-
L.current = !0, R.current = e.clientX - (((r = o.current) == null ? void 0 : r.offsetLeft) || 0), y.current = ((t = o.current) == null ? void 0 : t.scrollLeft) || 0;
|
|
18
|
-
}, E = (e) => {
|
|
19
|
-
L.current && (e.currentTarget.style.cursor = "grabbing", o.current && (o.current.scrollLeft = y.current - (e.clientX - o.current.offsetLeft - R.current)));
|
|
20
|
-
}, I = (e) => {
|
|
21
|
-
var t;
|
|
22
|
-
L.current = !1, y.current !== ((t = o.current) == null ? void 0 : t.scrollLeft) ? (e.currentTarget.style.cursor = "grab", p.current = !1, l.current && cancelAnimationFrame(l.current), l.current = requestAnimationFrame(() => {
|
|
23
|
-
p.current = !0;
|
|
24
|
-
})) : p.current = !0;
|
|
25
|
-
}, T = (e) => (r) => {
|
|
26
|
-
var M;
|
|
27
|
-
r.stopPropagation();
|
|
28
|
-
const t = Number(r.currentTarget.getAttribute("aria-posinset")) - 1;
|
|
29
|
-
let a = t;
|
|
30
|
-
switch (r.key) {
|
|
31
|
-
case "ArrowRight": {
|
|
32
|
-
r.preventDefault(), t + n < k && (a = t + n);
|
|
33
|
-
break;
|
|
34
|
-
}
|
|
35
|
-
case "ArrowLeft": {
|
|
36
|
-
r.preventDefault(), t - n >= 0 && (a = t - n);
|
|
37
|
-
break;
|
|
38
|
-
}
|
|
39
|
-
case "ArrowDown": {
|
|
40
|
-
r.preventDefault(), (t + 1) % n !== 0 && t + 1 < k && (a = t + 1);
|
|
41
|
-
break;
|
|
42
|
-
}
|
|
43
|
-
case "ArrowUp": {
|
|
44
|
-
r.preventDefault(), t % n !== 0 && t - 1 >= 0 && (a = t - 1);
|
|
45
|
-
break;
|
|
46
|
-
}
|
|
47
|
-
case "Enter":
|
|
48
|
-
case " ": {
|
|
49
|
-
r.preventDefault(), r.currentTarget.click();
|
|
50
|
-
return;
|
|
51
|
-
}
|
|
52
|
-
default:
|
|
53
|
-
return;
|
|
54
|
-
}
|
|
55
|
-
if (a !== t) {
|
|
56
|
-
const D = (M = o.current) == null ? void 0 : M.children[a];
|
|
57
|
-
D == null || D.focus();
|
|
58
|
-
}
|
|
59
|
-
e == null || e(r);
|
|
60
|
-
}, F = (e) => (r) => {
|
|
61
|
-
const t = Number(r.currentTarget.getAttribute("aria-posinset")) - 1;
|
|
62
|
-
h(t), e == null || e(r);
|
|
63
|
-
};
|
|
64
|
-
return x(() => {
|
|
65
|
-
const e = o.current, r = (t) => {
|
|
66
|
-
p.current || t.stopPropagation();
|
|
67
|
-
};
|
|
68
|
-
return e == null || e.addEventListener("click", r), () => {
|
|
69
|
-
e == null || e.removeEventListener("click", r);
|
|
70
|
-
};
|
|
71
|
-
}, []), x(() => {
|
|
72
|
-
const e = o.current, r = (t) => {
|
|
73
|
-
t.stopPropagation();
|
|
74
|
-
};
|
|
75
|
-
return e == null || e.addEventListener("touchmove", r), () => {
|
|
76
|
-
e == null || e.removeEventListener("touchmove", r);
|
|
77
|
-
};
|
|
78
|
-
}, []), x(() => () => {
|
|
79
|
-
l.current && cancelAnimationFrame(l.current);
|
|
80
|
-
}, []), /* @__PURE__ */ u(
|
|
81
|
-
d,
|
|
82
|
-
{
|
|
83
|
-
ref: o,
|
|
84
|
-
alignItems: "baseline",
|
|
85
|
-
gap: g,
|
|
86
|
-
pl: i,
|
|
87
|
-
pr: i,
|
|
88
|
-
onMouseDown: C,
|
|
89
|
-
onMouseMove: E,
|
|
90
|
-
onMouseUp: I,
|
|
91
|
-
onMouseLeave: I,
|
|
92
|
-
role: "list",
|
|
93
|
-
"aria-roledescription": "carousel",
|
|
94
|
-
"aria-label": "슬라이더",
|
|
95
|
-
...v,
|
|
96
|
-
inlineCSS: {
|
|
97
|
-
display: "grid",
|
|
98
|
-
gridAutoFlow: "column",
|
|
99
|
-
gridAutoColumns: "min-content",
|
|
100
|
-
overflowX: "auto",
|
|
101
|
-
scrollbarWidth: "none",
|
|
102
|
-
cursor: "grab",
|
|
103
|
-
transform: "translate3d(0, 0, 0)",
|
|
104
|
-
"&::-webkit-scrollbar": {
|
|
105
|
-
display: "none"
|
|
106
|
-
},
|
|
107
|
-
...b
|
|
108
|
-
},
|
|
109
|
-
children: A.map(
|
|
110
|
-
S,
|
|
111
|
-
(e, r) => {
|
|
112
|
-
var t;
|
|
113
|
-
return X(e, {
|
|
114
|
-
role: "listitem",
|
|
115
|
-
tabIndex: r === s ? 0 : -1,
|
|
116
|
-
"aria-roledescription": "slide",
|
|
117
|
-
"aria-posinset": r + 1,
|
|
118
|
-
"aria-setsize": k,
|
|
119
|
-
onKeyDown: T(e.props.onKeyDown),
|
|
120
|
-
onFocus: F(e.props.onFocus),
|
|
121
|
-
...e.props,
|
|
122
|
-
style: {
|
|
123
|
-
...(t = e.props) == null ? void 0 : t.style,
|
|
124
|
-
gridRow: `${r % n + 1} / ${r % n + 1}`
|
|
125
|
-
}
|
|
126
|
-
});
|
|
127
|
-
}
|
|
128
|
-
)
|
|
129
|
-
}
|
|
130
|
-
);
|
|
131
|
-
}
|
|
132
|
-
const Z = j(
|
|
133
|
-
({ children: f, totalCount: g = 0, onClickViewAll: i, ...n }, b) => {
|
|
134
|
-
const {
|
|
135
|
-
palette: { background: v },
|
|
136
|
-
spacing: s
|
|
137
|
-
} = U(), h = A.count(f);
|
|
138
|
-
return /* @__PURE__ */ m(
|
|
139
|
-
d,
|
|
140
|
-
{
|
|
141
|
-
ref: b,
|
|
142
|
-
tag: "section",
|
|
143
|
-
pt: 10,
|
|
144
|
-
pb: 10,
|
|
145
|
-
pl: 4,
|
|
146
|
-
pr: 4,
|
|
147
|
-
gap: 4,
|
|
148
|
-
flexDirection: "column",
|
|
149
|
-
"aria-labelledby": "lesson-notes-section-title",
|
|
150
|
-
...n,
|
|
151
|
-
inlineCSS: {
|
|
152
|
-
width: "100%",
|
|
153
|
-
backgroundColor: v.primary,
|
|
154
|
-
...n == null ? void 0 : n.inlineCSS
|
|
155
|
-
},
|
|
156
|
-
children: [
|
|
157
|
-
/* @__PURE__ */ m(d, { alignItems: "center", justifyContent: "space-between", gap: 1, children: [
|
|
158
|
-
/* @__PURE__ */ u(d, { alignItems: "center", gap: 2, children: /* @__PURE__ */ m(w, { id: "lesson-notes-section-title", tag: "h2", variant: "h2B", children: [
|
|
159
|
-
"선생님의 수업노트",
|
|
160
|
-
g > 0 && /* @__PURE__ */ m(
|
|
161
|
-
w,
|
|
162
|
-
{
|
|
163
|
-
tag: "span",
|
|
164
|
-
variant: "h4R",
|
|
165
|
-
color: "grey.70",
|
|
166
|
-
inlineCSS: { marginLeft: s.content(2), verticalAlign: 2 },
|
|
167
|
-
children: [
|
|
168
|
-
"(",
|
|
169
|
-
g.toLocaleString(),
|
|
170
|
-
"개)"
|
|
171
|
-
]
|
|
172
|
-
}
|
|
173
|
-
)
|
|
174
|
-
] }) }),
|
|
175
|
-
typeof i == "function" && /* @__PURE__ */ u(
|
|
176
|
-
B,
|
|
177
|
-
{
|
|
178
|
-
variant: "text",
|
|
179
|
-
size: "small",
|
|
180
|
-
color: "secondary",
|
|
181
|
-
endAdornment: /* @__PURE__ */ u(P, { name: "ChevronRightLine" }),
|
|
182
|
-
onClick: i,
|
|
183
|
-
children: "전체보기"
|
|
184
|
-
}
|
|
185
|
-
)
|
|
186
|
-
] }),
|
|
187
|
-
/* @__PURE__ */ u(
|
|
188
|
-
W,
|
|
189
|
-
{
|
|
190
|
-
rowCount: 1,
|
|
191
|
-
spacing: 3,
|
|
192
|
-
inlineCSS: {
|
|
193
|
-
width: `calc(100% + ${s.content(8)}px)`,
|
|
194
|
-
gridAutoColumns: h > 1 ? `calc(100% - ${s.content(8)}px)` : "100%",
|
|
195
|
-
margin: `0 -${s.content(4)}px`
|
|
196
|
-
},
|
|
197
|
-
children: f
|
|
198
|
-
}
|
|
199
|
-
)
|
|
200
|
-
]
|
|
201
|
-
}
|
|
202
|
-
);
|
|
203
|
-
}
|
|
204
|
-
);
|
|
205
|
-
export {
|
|
206
|
-
Z as L,
|
|
207
|
-
W as R
|
|
208
|
-
};
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import o from "dayjs";
|
|
2
|
-
import t from "./birthDateToAge.mjs";
|
|
3
|
-
describe("convertBirthDateToAge", (a) => {
|
|
4
|
-
a("만 나이를 반환한다.", () => {
|
|
5
|
-
const e = o().subtract(1, "year"), r = e.add(1, "day");
|
|
6
|
-
expect(t(e.format("YYYY-MM-DD"))).toEqual(1), expect(t(r.format("YYYY-MM-DD"))).toEqual(0);
|
|
7
|
-
}), a("유효하지 않은 날짜를 넘긴 경우에는 0을 반환한다.", () => {
|
|
8
|
-
const e = o().add(1, "day");
|
|
9
|
-
expect(t("invalid")).toEqual(0), expect(t("")).toEqual(0), expect(t(void 0)).toEqual(0), expect(t(e.format("YYYY-MM-DD"))).toEqual(0);
|
|
10
|
-
});
|
|
11
|
-
});
|
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
import t from "dayjs";
|
|
2
|
-
import a from "./getDateRange.mjs";
|
|
3
|
-
describe("getDateRange", () => {
|
|
4
|
-
test("시작 날짜와 종료 날짜 사이의 날짜를 배열로 반환한다.", () => {
|
|
5
|
-
const e = a("2024-03-01", "2024-03-03");
|
|
6
|
-
expect(e).toEqual([
|
|
7
|
-
{ label: "2024-03-01", value: t("2024-03-01").toDate() },
|
|
8
|
-
{ label: "2024-03-02", value: t("2024-03-02").toDate() },
|
|
9
|
-
{ label: "2024-03-03", value: t("2024-03-03").toDate() }
|
|
10
|
-
]);
|
|
11
|
-
}), test("시작 날짜가 종료 날짜보다 크면 빈 배열을 반환한다.", () => {
|
|
12
|
-
expect(a("2024-03-03", "2024-03-01")).toEqual([]);
|
|
13
|
-
}), test("유효하지 않은 날짜가 포함되면 빈 배열을 반환한다.", () => {
|
|
14
|
-
expect(a("invalid", "2024-03-03")).toEqual([]), expect(a("2024-03-01", "invalid")).toEqual([]);
|
|
15
|
-
}), test("YYYY-MM 형식으로 월 단위의 날짜를 반환한다.", () => {
|
|
16
|
-
const e = a("2024-01-01", "2024-03-01", { format: "YYYY-MM" });
|
|
17
|
-
expect(e).toEqual([
|
|
18
|
-
{ label: "2024-01", value: t("2024-01-01").toDate() },
|
|
19
|
-
{ label: "2024-02", value: t("2024-02-01").toDate() },
|
|
20
|
-
{ label: "2024-03", value: t("2024-03-01").toDate() }
|
|
21
|
-
]);
|
|
22
|
-
}), test("YYYY-MM-DD HH:mm 형식으로 날짜를 반환한다.", () => {
|
|
23
|
-
const e = a("2024-03-01 09:00", "2024-03-02 09:00", {
|
|
24
|
-
format: "YYYY-MM-DD HH:mm"
|
|
25
|
-
});
|
|
26
|
-
expect(e).toEqual([
|
|
27
|
-
{ label: "2024-03-01 09:00", value: t("2024-03-01 09:00").toDate() },
|
|
28
|
-
{ label: "2024-03-02 09:00", value: t("2024-03-02 09:00").toDate() }
|
|
29
|
-
]);
|
|
30
|
-
}), test("YYYY-MM-DD HH:mm:ss 형식으로 날짜를 반환한다.", () => {
|
|
31
|
-
const e = a("2024-03-01 09:00:00", "2024-03-02 09:00:00", {
|
|
32
|
-
format: "YYYY-MM-DD HH:mm:ss"
|
|
33
|
-
});
|
|
34
|
-
expect(e).toEqual([
|
|
35
|
-
{ label: "2024-03-01 09:00:00", value: t("2024-03-01 09:00:00").toDate() },
|
|
36
|
-
{ label: "2024-03-02 09:00:00", value: t("2024-03-02 09:00:00").toDate() }
|
|
37
|
-
]);
|
|
38
|
-
}), test("Date 객체를 입력으로 받을 수 있다.", () => {
|
|
39
|
-
const e = t("2024-03-01").toDate(), l = t("2024-03-03").toDate(), o = a(e, l);
|
|
40
|
-
expect(o).toEqual([
|
|
41
|
-
{ label: "2024-03-01", value: t("2024-03-01").toDate() },
|
|
42
|
-
{ label: "2024-03-02", value: t("2024-03-02").toDate() },
|
|
43
|
-
{ label: "2024-03-03", value: t("2024-03-03").toDate() }
|
|
44
|
-
]);
|
|
45
|
-
}), test("Dayjs 객체를 입력으로 받을 수 있다.", () => {
|
|
46
|
-
const e = t("2024-03-01"), l = t("2024-03-03"), o = a(e, l);
|
|
47
|
-
expect(o).toEqual([
|
|
48
|
-
{ label: "2024-03-01", value: t("2024-03-01").toDate() },
|
|
49
|
-
{ label: "2024-03-02", value: t("2024-03-02").toDate() },
|
|
50
|
-
{ label: "2024-03-03", value: t("2024-03-03").toDate() }
|
|
51
|
-
]);
|
|
52
|
-
}), test("Dayjs 객체와 Date 객체를 혼합해서 입력으로 받을 수 있다.", () => {
|
|
53
|
-
const e = t("2024-03-01"), l = t("2024-03-03").toDate(), o = a(e, l);
|
|
54
|
-
expect(o).toEqual([
|
|
55
|
-
{ label: "2024-03-01", value: t("2024-03-01").toDate() },
|
|
56
|
-
{ label: "2024-03-02", value: t("2024-03-02").toDate() },
|
|
57
|
-
{ label: "2024-03-03", value: t("2024-03-03").toDate() }
|
|
58
|
-
]);
|
|
59
|
-
});
|
|
60
|
-
});
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import e, { LAMBDA_VERSION as i } from "./getImageUrl.mjs";
|
|
2
|
-
describe("getImageUrl", () => {
|
|
3
|
-
const t = "https://example.com/image.jpg";
|
|
4
|
-
test("기본 옵션으로 URL을 생성한다.", () => {
|
|
5
|
-
expect(e({ src: t, width: 100, height: 200 })).toBe(
|
|
6
|
-
`${t}?v=${i}&fit=cover&position=center&width=200&height=400`
|
|
7
|
-
);
|
|
8
|
-
}), test("disabledResizing이 true일 경우 리사이징 파라미터를 추가하지 않는다.", () => {
|
|
9
|
-
expect(e({ src: t, width: 100, height: 200, disabledResizing: !0 })).toBe(
|
|
10
|
-
`${t}?v=${i}`
|
|
11
|
-
);
|
|
12
|
-
}), test("fit과 position 옵션을 변경하여 URL을 생성한다.", () => {
|
|
13
|
-
expect(e({ src: t, width: 100, height: 200, fit: "contain", position: "top" })).toBe(
|
|
14
|
-
`${t}?v=${i}&fit=contain&position=top&width=200&height=400`
|
|
15
|
-
);
|
|
16
|
-
}), test("scale을 1로 설정하면 원본 크기로 설정된다.", () => {
|
|
17
|
-
expect(e({ src: t, width: 100, height: 200, scale: 1 })).toBe(
|
|
18
|
-
`${t}?v=${i}&fit=cover&position=center&width=100&height=200`
|
|
19
|
-
);
|
|
20
|
-
}), test("width 또는 height가 제공되지 않을 경우 해당 파라미터를 추가하지 않는다.", () => {
|
|
21
|
-
expect(e({ src: t, width: 100 })).toBe(
|
|
22
|
-
`${t}?v=${i}&fit=cover&position=center&width=200`
|
|
23
|
-
), expect(e({ src: t, height: 200 })).toBe(
|
|
24
|
-
`${t}?v=${i}&fit=cover&position=center&height=400`
|
|
25
|
-
);
|
|
26
|
-
});
|
|
27
|
-
});
|
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
import e from "./getTimeRange.mjs";
|
|
2
|
-
describe("getTimeRange", () => {
|
|
3
|
-
test("시작 시간과 종료 시간 사이의 시간을 배열로 반환한다.", () => {
|
|
4
|
-
const l = e(5.5, 10.5);
|
|
5
|
-
expect(l).toEqual([
|
|
6
|
-
{ label: "05:30", value: 5.5 },
|
|
7
|
-
{ label: "06:00", value: 6 },
|
|
8
|
-
{ label: "06:30", value: 6.5 },
|
|
9
|
-
{ label: "07:00", value: 7 },
|
|
10
|
-
{ label: "07:30", value: 7.5 },
|
|
11
|
-
{ label: "08:00", value: 8 },
|
|
12
|
-
{ label: "08:30", value: 8.5 },
|
|
13
|
-
{ label: "09:00", value: 9 },
|
|
14
|
-
{ label: "09:30", value: 9.5 },
|
|
15
|
-
{ label: "10:00", value: 10 },
|
|
16
|
-
{ label: "10:30", value: 10.5 }
|
|
17
|
-
]);
|
|
18
|
-
}), test("시작 시간이 종료 시간보다 크면 빈 배열을 반환한다.", () => {
|
|
19
|
-
expect(e(10.5, 5.5)).toEqual([]);
|
|
20
|
-
}), test("음수 시간이 포함되면 빈 배열을 반환한다.", () => {
|
|
21
|
-
expect(e(-1, 5.5)).toEqual([]), expect(e(5.5, -1)).toEqual([]);
|
|
22
|
-
}), test("step이 0 이하면 빈 배열을 반환한다.", () => {
|
|
23
|
-
expect(e(5.5, 10.5, { step: 0 })).toEqual([]), expect(e(5.5, 10.5, { step: -0.5 })).toEqual([]);
|
|
24
|
-
}), test("minTime과 maxTime을 적용할 수 있다.", () => {
|
|
25
|
-
const l = e(5.5, 10.5, {
|
|
26
|
-
minTime: 6,
|
|
27
|
-
maxTime: 9.5
|
|
28
|
-
});
|
|
29
|
-
expect(l).toEqual([
|
|
30
|
-
{ label: "06:00", value: 6 },
|
|
31
|
-
{ label: "06:30", value: 6.5 },
|
|
32
|
-
{ label: "07:00", value: 7 },
|
|
33
|
-
{ label: "07:30", value: 7.5 },
|
|
34
|
-
{ label: "08:00", value: 8 },
|
|
35
|
-
{ label: "08:30", value: 8.5 },
|
|
36
|
-
{ label: "09:00", value: 9 },
|
|
37
|
-
{ label: "09:30", value: 9.5 }
|
|
38
|
-
]);
|
|
39
|
-
}), test("step을 조정할 수 있다.", () => {
|
|
40
|
-
const l = e(5.5, 7.5, { step: 1 });
|
|
41
|
-
expect(l).toEqual([
|
|
42
|
-
{ label: "05:30", value: 5.5 },
|
|
43
|
-
{ label: "06:30", value: 6.5 },
|
|
44
|
-
{ label: "07:30", value: 7.5 }
|
|
45
|
-
]);
|
|
46
|
-
}), test("pairs 옵션을 사용하면 연속된 시간 쌍을 반환한다.", () => {
|
|
47
|
-
const l = e(8.5, 9.5, { pairs: !0 });
|
|
48
|
-
expect(l).toEqual([
|
|
49
|
-
{ label: "08:30", value: 8.5 },
|
|
50
|
-
// 첫 번째 쌍의 시작 시간
|
|
51
|
-
{ label: "09:00", value: 9 },
|
|
52
|
-
// 첫 번째 쌍의 종료 시간
|
|
53
|
-
{ label: "09:00", value: 9 },
|
|
54
|
-
// 두 번째 쌍의 시작 시간
|
|
55
|
-
{ label: "09:30", value: 9.5 }
|
|
56
|
-
// 두 번째 쌍의 종료 시간
|
|
57
|
-
]);
|
|
58
|
-
}), test("pairs 옵션과 다른 옵션을 함께 사용할 수 있다.", () => {
|
|
59
|
-
const l = e(8.5, 10.5, {
|
|
60
|
-
pairs: !0,
|
|
61
|
-
minTime: 9,
|
|
62
|
-
maxTime: 10
|
|
63
|
-
});
|
|
64
|
-
expect(l).toEqual([
|
|
65
|
-
{ label: "09:00", value: 9 },
|
|
66
|
-
// 첫 번째 쌍의 시작 시간
|
|
67
|
-
{ label: "09:30", value: 9.5 },
|
|
68
|
-
// 첫 번째 쌍의 종료 시간
|
|
69
|
-
{ label: "09:30", value: 9.5 },
|
|
70
|
-
// 두 번째 쌍의 시작 시간
|
|
71
|
-
{ label: "10:00", value: 10 }
|
|
72
|
-
// 두 번째 쌍의 종료 시간
|
|
73
|
-
]);
|
|
74
|
-
});
|
|
75
|
-
});
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import e from "./getVimeoId.mjs";
|
|
2
|
-
describe("getVimeoId", (o) => {
|
|
3
|
-
o("유효한 Vimeo URL에서 ID를 추출한다.", () => {
|
|
4
|
-
expect(e("https://vimeo.com/123456789")).toBe(123456789);
|
|
5
|
-
}), o("URL이 비어있으면 0을 반환한다.", () => {
|
|
6
|
-
expect(e("")).toBe(0);
|
|
7
|
-
}), o("Vimeo URL이 아니면 0을 반환한다.", () => {
|
|
8
|
-
expect(e("https://youtube.com/watch?v=abcdef")).toBe(0);
|
|
9
|
-
}), o("ID가 포함되지 않은 Vimeo URL이면 0을 반환한다.", () => {
|
|
10
|
-
expect(e("https://vimeo.com/")).toBe(0);
|
|
11
|
-
}), o("올바르지 않은 URL 형식이면 0을 반환한다.", () => {
|
|
12
|
-
expect(e("")).toBe(0), expect(e(void 0)).toBe(0), expect(e("parent.tictoccroc.com")).toBe(0), expect(e("parent.tictoccroc.com///")).toBe(0), expect(e("tictocisland")).toBe(0);
|
|
13
|
-
});
|
|
14
|
-
});
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import e from "./isAndroid.mjs";
|
|
2
|
-
describe("isAndroid", () => {
|
|
3
|
-
afterEach(() => {
|
|
4
|
-
vi.restoreAllMocks();
|
|
5
|
-
}), test("Android userAgent일 때 true를 반환한다.", () => {
|
|
6
|
-
vi.stubGlobal("navigator", { userAgent: "Mozilla/5.0 (Linux; Android 10) AppleWebKit/537.36" }), expect(e()).toBe(!0);
|
|
7
|
-
}), test("Android가 아닌 userAgent일 때 false를 반환한다.", () => {
|
|
8
|
-
vi.stubGlobal("navigator", {
|
|
9
|
-
userAgent: "Mozilla/5.0 (iPhone; CPU iPhone OS 14_0 like Mac OS X) AppleWebKit/537.36"
|
|
10
|
-
}), expect(e()).toBe(!1);
|
|
11
|
-
});
|
|
12
|
-
});
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import e from "./isApp.mjs";
|
|
2
|
-
describe("isApp", () => {
|
|
3
|
-
beforeEach(() => {
|
|
4
|
-
vi.stubGlobal("document", {}), vi.stubGlobal("window", {});
|
|
5
|
-
}), afterEach(() => {
|
|
6
|
-
vi.restoreAllMocks();
|
|
7
|
-
}), test("웹 환경에서는 false를 반환한다.", () => {
|
|
8
|
-
expect(e()).toBe(!1);
|
|
9
|
-
}), test("앱 환경에서는 true를 반환한다.", () => {
|
|
10
|
-
Object.defineProperty(window, "flutter_inappwebview", {
|
|
11
|
-
value: {
|
|
12
|
-
callHandler: () => {
|
|
13
|
-
}
|
|
14
|
-
},
|
|
15
|
-
configurable: !0
|
|
16
|
-
}), expect(e()).toBe(!0);
|
|
17
|
-
}), test("document가 존재하지 않으면 false를 반환한다.", () => {
|
|
18
|
-
vi.stubGlobal("document", void 0), expect(e()).toBe(!1);
|
|
19
|
-
}), test("window가 존재하지 않으면 false를 반환한다.", () => {
|
|
20
|
-
vi.stubGlobal("window", void 0), expect(e()).toBe(!1);
|
|
21
|
-
});
|
|
22
|
-
});
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import e from "./isDesktop.mjs";
|
|
2
|
-
describe("isDesktop", (t) => {
|
|
3
|
-
afterEach(() => {
|
|
4
|
-
vi.restoreAllMocks();
|
|
5
|
-
}), t("모바일 환경인 경우 false를 반환한다.", () => {
|
|
6
|
-
vi.stubGlobal("navigator", { userAgent: "android" }), expect(e()).toBe(!1), vi.stubGlobal("navigator", { userAgent: "iphone" }), expect(e()).toBe(!1), vi.stubGlobal("navigator", { userAgent: "ipad" }), expect(e()).toBe(!1), vi.stubGlobal("navigator", { userAgent: "mobile" }), expect(e()).toBe(!1);
|
|
7
|
-
}), t("데스크탑 환경인 경우 true를 반환한다.", () => {
|
|
8
|
-
vi.stubGlobal("navigator", { userAgent: "windows" }), expect(e()).toBe(!0), vi.stubGlobal("navigator", { userAgent: "mac" }), expect(e()).toBe(!0), vi.stubGlobal("navigator", { userAgent: "linux" }), expect(e()).toBe(!0);
|
|
9
|
-
});
|
|
10
|
-
});
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import o from "./isServer.mjs";
|
|
2
|
-
describe("isServer", (e) => {
|
|
3
|
-
afterEach(() => {
|
|
4
|
-
vi.restoreAllMocks();
|
|
5
|
-
}), e("document가 존재하면 false를 반환한다.", () => {
|
|
6
|
-
vi.stubGlobal("document", {}), expect(o()).toBe(!1);
|
|
7
|
-
}), e("document가 존재하지 않으면 true를 반환한다.", () => {
|
|
8
|
-
vi.stubGlobal("document", void 0), expect(o()).toBe(!0);
|
|
9
|
-
}), e("window가 존재하지 않으면 true를 반환한다.", () => {
|
|
10
|
-
vi.stubGlobal("window", void 0), expect(o()).toBe(!0);
|
|
11
|
-
});
|
|
12
|
-
});
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import e from "./objectToQueryString.mjs";
|
|
2
|
-
describe("convertObjectToQueryString", (t) => {
|
|
3
|
-
t("object 타입이 들어왔을 때 query string으로 변환한다.", () => {
|
|
4
|
-
const c = { a: 1, b: !0, c: "test", d: void 0, e: null, f: { fa: 1 } };
|
|
5
|
-
expect(e(c)).toEqual(
|
|
6
|
-
"?a=1&b=true&c=test&d=undefined&e=null&f=%5Bobject+Object%5D"
|
|
7
|
-
);
|
|
8
|
-
}), t("변환할 수 없는 타입이 들어온 경우 빈 문자열을 반환한다.", () => {
|
|
9
|
-
expect(e(null)).toEqual(""), expect(e(void 0)).toEqual("");
|
|
10
|
-
});
|
|
11
|
-
});
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import e from "./parseQueryString.mjs";
|
|
2
|
-
describe("parseQueryStrings", (a) => {
|
|
3
|
-
a("단일 키:값 쌍을 넘겼을 떄 Object를 리턴한다.", () => {
|
|
4
|
-
expect(e("key=value")).toEqual({ key: "value" });
|
|
5
|
-
}), a("두 개 이상의 키:값 쌍을 넘겼을 때 Object를 리턴한다.", () => {
|
|
6
|
-
expect(e("key1=value1&key2=value2")).toEqual({
|
|
7
|
-
key1: "value1",
|
|
8
|
-
key2: "value2"
|
|
9
|
-
});
|
|
10
|
-
}), a("빈 값을 넘겼을 때 빈 Object를 리턴한다.", () => {
|
|
11
|
-
expect(e()).toEqual({}), expect(e(void 0)).toEqual({}), expect(e("")).toEqual({});
|
|
12
|
-
}), a("유효하지 않은 값을 넘겼을 때에도 Object를 리턴한다.", () => {
|
|
13
|
-
expect(e("key=")).toEqual({ key: "" }), expect(e("key")).toEqual({ key: "" }), expect(e("=value")).toEqual({ "": "value" });
|
|
14
|
-
});
|
|
15
|
-
});
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import o from "./share.mjs";
|
|
2
|
-
describe("share", () => {
|
|
3
|
-
const a = { title: "test", text: "test", url: "test" }, t = vi.fn(() => !0), e = vi.fn(() => !0), r = vi.fn(async () => !0).mockResolvedValue(!0);
|
|
4
|
-
afterEach(() => {
|
|
5
|
-
vi.restoreAllMocks();
|
|
6
|
-
}), test("navigator에 canShare가 없는 경우 onError를 호출한다.", () => {
|
|
7
|
-
vi.stubGlobal("window", { navigator: { share: r } }), o(a, { onError: e }), expect(e).toHaveBeenCalledTimes(1);
|
|
8
|
-
}), test("navigator.canShare가 false를 반환하는 경우 onError를 호출한다.", () => {
|
|
9
|
-
vi.stubGlobal("window", {
|
|
10
|
-
navigator: {
|
|
11
|
-
canShare: () => !1,
|
|
12
|
-
share: r
|
|
13
|
-
}
|
|
14
|
-
}), o(a, { onError: e }), expect(e).toHaveBeenCalledTimes(1);
|
|
15
|
-
}), test("navigator.canShare가 true를 반환하는 경우 navigator.share를 호출하고 onSuccess를 실행한다.", async () => {
|
|
16
|
-
vi.stubGlobal("window", {
|
|
17
|
-
navigator: {
|
|
18
|
-
canShare: () => !0,
|
|
19
|
-
share: r
|
|
20
|
-
}
|
|
21
|
-
}), await o(a, { onSuccess: t, onError: e }), expect(r).toHaveBeenCalledWith(a), expect(t).toHaveBeenCalledTimes(1), expect(e).not.toHaveBeenCalled();
|
|
22
|
-
}), test("navigator.share가 실패하면 onSucces를 호출하지 않는다.", async () => {
|
|
23
|
-
const n = vi.fn().mockRejectedValue(new Error("Share failed"));
|
|
24
|
-
vi.stubGlobal("window", {
|
|
25
|
-
navigator: {
|
|
26
|
-
canShare: () => !0,
|
|
27
|
-
share: n
|
|
28
|
-
}
|
|
29
|
-
}), await o(a, { onSuccess: t, onError: e }), expect(t).not.toHaveBeenCalled();
|
|
30
|
-
});
|
|
31
|
-
});
|