1 /*
2 * Copyright (c) 2021-2022 Huawei Device Co., Ltd.
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at
6 *
7 * http://www.apache.org/licenses/LICENSE-2.0
8 *
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
14 */
15
16 #include "gtest/gtest.h"
17
18 #include "base/geometry/dimension.h"
19 #include "core/components/button/button_component.h"
20 #include "core/components/button/button_theme.h"
21 #include "core/components/checkable/checkable_component.h"
22 #include "core/components/checkable/checkable_theme.h"
23 #include "core/components/common/layout/constants.h"
24 #include "core/components/text_field/text_field_component.h"
25 #include "core/components/text_field/textfield_theme.h"
26 #include "core/components/theme/theme_manager_impl.h"
27 #include "frameworks/bridge/common/dom/dom_document.h"
28 #include "frameworks/bridge/common/dom/dom_input.h"
29 #include "frameworks/bridge/test/unittest/jsfrontend/dom_node_factory.h"
30
31 using namespace testing;
32 using namespace testing::ext;
33
34 namespace OHOS::Ace::Framework {
35 namespace {
36
37 const bool INPUT_CHECKED_VALUE_DEFAULT = false;
38
39 #ifndef WEARABLE_PRODUCT
40 constexpr uint32_t INPUT_MAXLENGTH_VALUE_DEFAULT = std::numeric_limits<uint32_t>::max();
41 const FontWeight INPUT_FONT_WEIGHT_VALUE_DEFAULT = FontWeight::W400;
42 const std::string INPUT_FONT_FAMILY_VALUE_DEFAULT = "sans-serif";
43
44 const std::string INPUT_PLACEHOLDER_VALUE = "please input";
45 const std::string INPUT_PLACEHOLDER_COLOR_STR_VALUE = "#12345678";
46 const std::string INPUT_CURCOR_COLOR_STR_VALUE = "#12345678";
47 constexpr uint32_t INPUT_MAXLENGTH_VALUE = 100;
48 const TextInputAction INPUT_TEXTINPUTACTION_VALUE = TextInputAction::NEXT;
49 const std::string INPUT_HEADER_ICON = "test.png";
50 const std::string INPUT_COLOR_STR_VALUE = "#12345678";
51 const Dimension INPUT_FONT_SIZE_VALUE = Dimension(30.0, DimensionUnit::PX);
52 const FontWeight INPUT_FONT_WEIGHT_VALUE = FontWeight::W600;
53 const std::string INPUT_FONT_FAMILY_VALUE = "serif";
54 #endif
55
56 const bool INPUT_CHECKED_VALUE = true;
57 const std::string INPUT_NAME_VALUE = "input name";
58 const std::string INPUT_VALUE_VALUE = "input value";
59 const Dimension INPUT_WIDTH_VALUE = Dimension(100, DimensionUnit::PX);
60 const Dimension INPUT_HEIGHT_VALUE = Dimension(50, DimensionUnit::PX);
61 const Dimension BUTTON_WIDTH_INIT = Dimension(-1.0, DimensionUnit::PX);
62 const RefPtr<ThemeManager> THEME_MANAGER = AceType::MakeRefPtr<ThemeManagerImpl>();
63
64 } // namespace
65
66 class DomInputTest : public testing::Test {
67 public:
68 static void SetUpTestCase();
69 static void TearDownTestCase();
70 void SetUp();
71 void TearDown();
72 };
73
SetUpTestCase()74 void DomInputTest::SetUpTestCase() {}
TearDownTestCase()75 void DomInputTest::TearDownTestCase() {}
SetUp()76 void DomInputTest::SetUp() {}
TearDown()77 void DomInputTest::TearDown() {}
78
79 /**
80 * @tc.name: DomInputCreatorTest001
81 * @tc.desc: Test textfield component are created as default.
82 * @tc.type: FUNC
83 */
84 HWTEST_F(DomInputTest, DomInputCreatorTest001, TestSize.Level1)
85 {
86 const std::string inputTestJsonStr = "{"
87 " \"tag\": \"input\", "
88 " \"attr\": [{ "
89 " \"type\": \"text\" "
90 " }] "
91 "}";
92 /**
93 * @tc.steps: step1. Construct string without style and attribute, then create input node with it
94 * @tc.expected: step1. input component are created successfully.
95 */
96 auto domNodeRoot = DOMNodeFactory::GetInstance().CreateDOMNodeFromDsl(inputTestJsonStr);
97 auto boxChild = DOMNodeFactory::GetInstance().GetBoxChildComponent(domNodeRoot);
98 ASSERT_TRUE(boxChild);
99
100 #ifndef WEARABLE_PRODUCT
101 RefPtr<TextFieldComponent> textareaComponent = AceType::DynamicCast<TextFieldComponent>(boxChild->GetChild());
102 ASSERT_TRUE(textareaComponent);
103
104 /**
105 * @tc.steps: step2. Check styles and attributes of created input node.
106 * @tc.expected: step2. The styles and attributes are as expected.
107 */
108 RefPtr<TextFieldTheme> theme = THEME_MANAGER->GetTheme<TextFieldTheme>();
109 ASSERT_TRUE(theme);
110
111 EXPECT_EQ(textareaComponent->GetPlaceholderColor(), theme->GetPlaceholderColor());
112 EXPECT_EQ(textareaComponent->GetMaxLength(), INPUT_MAXLENGTH_VALUE_DEFAULT);
113
114 auto style = textareaComponent->GetTextStyle();
115 EXPECT_EQ(style.GetTextColor(), theme->GetTextColor());
116 EXPECT_EQ(style.GetFontSize(), theme->GetFontSize());
117 EXPECT_EQ(style.GetFontWeight(), INPUT_FONT_WEIGHT_VALUE_DEFAULT);
118 EXPECT_EQ(style.GetFontFamilies()[0], INPUT_FONT_FAMILY_VALUE_DEFAULT);
119
120 RefPtr<Decoration> decoration = textareaComponent->GetDecoration();
121 EXPECT_EQ(decoration->GetBackgroundColor(), theme->GetBgColor());
122 #endif
123 }
124
125 /**
126 * @tc.name: DomInputCreatorTest002
127 * @tc.desc: Test textfield component are created with all style and attribute.
128 * @tc.type: FUNC
129 */
130 HWTEST_F(DomInputTest, DomInputCreatorTest002, TestSize.Level1)
131 {
132 const std::string inputTestJsonStr = "{"
133 " \"tag\": \"input\", "
134 " \"attr\": [{ "
135 " \"type\": \"text\" "
136 " }, "
137 " { "
138 " \"placeholder\": \"please input\" "
139 " }, "
140 " { "
141 " \"maxlength\": \"100\" "
142 " }, "
143 " { "
144 " \"enterkeytype\": \"next\" "
145 " }, "
146 " { "
147 " \"disabled\": \"true\" "
148 " }, "
149 " { "
150 " \"headerIcon\": \"test.png\" "
151 " }, "
152 " { "
153 " \"obscure\": \"true\" "
154 " }], "
155 " \"style\": [{ "
156 " \"color\" : \"#12345678\" "
157 " }, "
158 " { "
159 " \"cursorColor\": \"#12345678\" "
160 " }, "
161 " { "
162 " \"placeholderColor\": \"#12345678\" "
163 " }, "
164 " { "
165 " \"fontSize\": \"30.0\" "
166 " }, "
167 " { "
168 " \"fontWeight\": \"600\" "
169 " }, "
170 " { "
171 " \"fontFamily\": \"serif\" "
172 " }] "
173 "}";
174 /**
175 * @tc.steps: step1. Construct string with all style and attribute, then create input node with it
176 * @tc.expected: step1. input component are created successfully.
177 */
178 auto domNodeRoot = DOMNodeFactory::GetInstance().CreateDOMNodeFromDsl(inputTestJsonStr);
179 auto boxChild = DOMNodeFactory::GetInstance().GetBoxChildComponent(domNodeRoot);
180 ASSERT_TRUE(boxChild);
181
182 #ifndef WEARABLE_PRODUCT
183 RefPtr<TextFieldComponent> textareaComponent = AceType::DynamicCast<TextFieldComponent>(boxChild->GetChild());
184 ASSERT_TRUE(textareaComponent);
185
186 /**
187 * @tc.steps: step2. Check styles and attributes of created input node.
188 * @tc.expected: step2. The styles and attributes are as expected.
189 */
190 EXPECT_EQ(textareaComponent->GetPlaceholder(), INPUT_PLACEHOLDER_VALUE);
191 EXPECT_EQ(textareaComponent->GetPlaceholderColor(), Color::FromString(INPUT_PLACEHOLDER_COLOR_STR_VALUE));
192 EXPECT_EQ(textareaComponent->GetCursorColor(), Color::FromString(INPUT_CURCOR_COLOR_STR_VALUE));
193 EXPECT_EQ(textareaComponent->GetMaxLength(), INPUT_MAXLENGTH_VALUE);
194 EXPECT_EQ(textareaComponent->GetAction(), INPUT_TEXTINPUTACTION_VALUE);
195 EXPECT_EQ(textareaComponent->IsEnabled(), false);
196 EXPECT_EQ(textareaComponent->NeedObscure(), true);
197 EXPECT_EQ(textareaComponent->GetIconImage(), INPUT_HEADER_ICON);
198
199 auto style = textareaComponent->GetTextStyle();
200 EXPECT_EQ(style.GetTextColor(), Color::FromString(INPUT_COLOR_STR_VALUE));
201 EXPECT_EQ(style.GetFontSize(), INPUT_FONT_SIZE_VALUE);
202 EXPECT_EQ(style.GetFontWeight(), INPUT_FONT_WEIGHT_VALUE);
203 EXPECT_EQ(style.GetFontFamilies()[0], INPUT_FONT_FAMILY_VALUE);
204 #endif
205 }
206
207 /**
208 * @tc.name: DomInputCreatorTest003
209 * @tc.desc: Test input component are created with event.
210 * @tc.type: FUNC
211 */
212 HWTEST_F(DomInputTest, DomInputCreatorTest003, TestSize.Level1)
213 {
214 const std::string inputTestJsonStr = "{"
215 " \"tag\": \"input\", "
216 " \"attr\": [{ "
217 " \"type\": \"text\" "
218 " }], "
219 " \"event\": [ "
220 " \"change\", "
221 " \"enterkeyclick\" "
222 " ] "
223 "}";
224 /**
225 * @tc.steps: step1. Construct string with event, then create input node with it
226 * @tc.expected: step1. input component are created successfully.
227 */
228 auto domNodeRoot = DOMNodeFactory::GetInstance().CreateDOMNodeFromDsl(inputTestJsonStr);
229 auto boxChild = DOMNodeFactory::GetInstance().GetBoxChildComponent(domNodeRoot);
230 ASSERT_TRUE(boxChild);
231
232 #ifndef WEARABLE_PRODUCT
233 RefPtr<TextFieldComponent> textareaComponent = AceType::DynamicCast<TextFieldComponent>(boxChild->GetChild());
234 ASSERT_TRUE(textareaComponent);
235
236 /**
237 * @tc.steps: step2. Check event of created input node.
238 * @tc.expected: step2. The styles and attributes are as expected.
239 */
240 EXPECT_EQ(textareaComponent->GetOnTextChange(), std::to_string(domNodeRoot->GetNodeId()));
241 EXPECT_EQ(textareaComponent->GetOnFinishInput(), std::to_string(domNodeRoot->GetNodeId()));
242 #endif
243 }
244
245 /**
246 * @tc.name: DomInputCreatorTest004
247 * @tc.desc: Test button component are created as default.
248 * @tc.type: FUNC
249 */
250 HWTEST_F(DomInputTest, DomInputCreatorTest004, TestSize.Level1)
251 {
252 const std::string inputTestJsonStr = "{"
253 " \"tag\": \"input\", "
254 " \"attr\": [{ "
255 " \"type\": \"button\" "
256 " }, "
257 " { "
258 " \"name\": \"input name\" "
259 " }] "
260 "}";
261 /**
262 * @tc.steps: step1. Construct string without style and attribute, then create input node with it
263 * @tc.expected: step1. input component are created successfully.
264 */
265 auto domNodeRoot = DOMNodeFactory::GetInstance().CreateDOMNodeFromDsl(inputTestJsonStr);
266 auto boxChild = DOMNodeFactory::GetInstance().GetBoxChildComponent(domNodeRoot);
267 ASSERT_TRUE(boxChild);
268 RefPtr<ButtonComponent> buttonComponent = AceType::DynamicCast<ButtonComponent>(boxChild->GetChild());
269 ASSERT_TRUE(buttonComponent);
270
271 /**
272 * @tc.steps: step2. Check styles and attributes of created input node.
273 * @tc.expected: step2. The styles and attributes are as expected.
274 */
275 RefPtr<ButtonTheme> theme = THEME_MANAGER->GetTheme<ButtonTheme>();
276 ASSERT_TRUE(theme);
277
278 EXPECT_EQ(buttonComponent->GetType(), ButtonType::NORMAL);
279 EXPECT_EQ(buttonComponent->GetWidth(), BUTTON_WIDTH_INIT);
280 }
281
282 /**
283 * @tc.name: DomInputCreatorTest005
284 * @tc.desc: Test button component are created with all style and attribute.
285 * @tc.type: FUNC
286 */
287 HWTEST_F(DomInputTest, DomInputCreatorTest005, TestSize.Level1)
288 {
289 const std::string inputTestJsonStr = "{"
290 " \"tag\": \"input\", "
291 " \"attr\": [{ "
292 " \"type\": \"button\" "
293 " }, "
294 " { "
295 " \"name\": \"input name\" "
296 " }, "
297 " { "
298 " \"value\": \"input value\" "
299 " }, "
300 " { "
301 " \"disabled\": \"true\" "
302 " }], "
303 " \"style\": [{ "
304 " \"color\" : \"#12345678\" "
305 " }, "
306 " { "
307 " \"fontSize\": \"30.0\" "
308 " }, "
309 " { "
310 " \"fontWeight\": \"600\" "
311 " }, "
312 " { "
313 " \"width\": \"100\" "
314 " }, "
315 " { "
316 " \"height\": \"50\" "
317 " }, "
318 " { "
319 " \"fontFamily\": \"serif\" "
320 " }] "
321 "}";
322 /**
323 * @tc.steps: step1. Construct string without style and attribute, then create input node with it
324 * @tc.expected: step1. input component are created successfully.
325 */
326 auto domNodeRoot = DOMNodeFactory::GetInstance().CreateDOMNodeFromDsl(inputTestJsonStr);
327 auto boxChild = DOMNodeFactory::GetInstance().GetBoxChildComponent(domNodeRoot);
328 ASSERT_TRUE(boxChild);
329 RefPtr<ButtonComponent> buttonComponent = AceType::DynamicCast<ButtonComponent>(boxChild->GetChild());
330 ASSERT_TRUE(buttonComponent);
331
332 /**
333 * @tc.steps: step2. Check styles and attributes of created input node.
334 * @tc.expected: step2. The styles and attributes are as expected.
335 */
336 EXPECT_EQ(buttonComponent->GetType(), ButtonType::NORMAL);
337 EXPECT_EQ(buttonComponent->GetDisabledState(), true);
338 EXPECT_EQ(boxChild->GetWidthDimension().Value(), INPUT_WIDTH_VALUE.Value());
339 EXPECT_EQ(boxChild->GetHeightDimension().Value(), INPUT_HEIGHT_VALUE.Value());
340 }
341
342 /**
343 * @tc.name: DomInputCreatorTest006
344 * @tc.desc: Test input component are created with event.
345 * @tc.type: FUNC
346 */
347 HWTEST_F(DomInputTest, DomInputCreatorTest006, TestSize.Level1)
348 {
349 const std::string inputTestJsonStr = "{"
350 " \"tag\": \"input\", "
351 " \"attr\": [{ "
352 " \"type\": \"button\" "
353 " }], "
354 " \"event\": [ "
355 " \"click\" "
356 " ] "
357 "}";
358 /**
359 * @tc.steps: step1. Construct string with event, then create input node with it
360 * @tc.expected: step1. input component are created successfully.
361 */
362 auto domNodeRoot = DOMNodeFactory::GetInstance().CreateDOMNodeFromDsl(inputTestJsonStr);
363 auto boxChild = DOMNodeFactory::GetInstance().GetBoxChildComponent(domNodeRoot);
364 ASSERT_TRUE(boxChild);
365 RefPtr<ButtonComponent> buttonComponent = AceType::DynamicCast<ButtonComponent>(boxChild->GetChild());
366 ASSERT_TRUE(buttonComponent);
367
368 /**
369 * @tc.steps: step2. Check event of created input node.
370 * @tc.expected: step2. The styles and attributes are as expected.
371 */
372 EXPECT_EQ(buttonComponent->GetClickedEventId(), std::to_string(domNodeRoot->GetNodeId()));
373 }
374
375 /**
376 * @tc.name: DomInputCreatorTest007
377 * @tc.desc: Test checkbox component are created as default.
378 * @tc.type: FUNC
379 */
380 HWTEST_F(DomInputTest, DomInputCreatorTest007, TestSize.Level1)
381 {
382 const std::string inputTestJsonStr = "{"
383 " \"tag\": \"input\", "
384 " \"attr\": [{ "
385 " \"type\": \"checkbox\" "
386 " }] "
387 "}";
388 /**
389 * @tc.steps: step1. Construct string without style and attribute, then create input node with it
390 * @tc.expected: step1. input component are created successfully.
391 */
392 auto domNodeRoot = DOMNodeFactory::GetInstance().CreateDOMNodeFromDsl(inputTestJsonStr);
393 auto boxChild = DOMNodeFactory::GetInstance().GetBoxChildComponent(domNodeRoot);
394 ASSERT_TRUE(boxChild);
395 RefPtr<CheckboxComponent> checkboxComponent = AceType::DynamicCast<CheckboxComponent>(boxChild->GetChild());
396 ASSERT_TRUE(checkboxComponent);
397
398 /**
399 * @tc.steps: step2. Check styles and attributes of created input node.
400 * @tc.expected: step2. The styles and attributes are as expected.
401 */
402 RefPtr<CheckboxTheme> theme = THEME_MANAGER->GetTheme<CheckboxTheme>();
403 ASSERT_TRUE(theme);
404
405 EXPECT_EQ(checkboxComponent->GetValue(), INPUT_CHECKED_VALUE_DEFAULT);
406 EXPECT_EQ(checkboxComponent->GetWidth(), theme->GetWidth());
407 EXPECT_EQ(checkboxComponent->GetHeight(), theme->GetHeight());
408 }
409
410 /**
411 * @tc.name: DomInputCreatorTest008
412 * @tc.desc: Test checkbox component are created with all style and attribute.
413 * @tc.type: FUNC
414 */
415 HWTEST_F(DomInputTest, DomInputCreatorTest008, TestSize.Level1)
416 {
417 const std::string inputTestJsonStr = "{"
418 " \"tag\": \"input\", "
419 " \"attr\": [{ "
420 " \"type\": \"checkbox\" "
421 " }, "
422 " { "
423 " \"checked\": \"true\" "
424 " }, "
425 " { "
426 " \"name\": \"input name\" "
427 " }, "
428 " { "
429 " \"value\": \"input value\" "
430 " }, "
431 " { "
432 " \"disabled\": \"true\" "
433 " }], "
434 " \"style\": [{ "
435 " \"width\": \"100\" "
436 " }, "
437 " { "
438 " \"height\": \"50\" "
439 " }] "
440 "}";
441 /**
442 * @tc.steps: step1. Construct string without style and attribute, then create input node with it
443 * @tc.expected: step1. input component are created successfully.
444 */
445 auto domNodeRoot = DOMNodeFactory::GetInstance().CreateDOMNodeFromDsl(inputTestJsonStr);
446 auto boxChild = DOMNodeFactory::GetInstance().GetBoxChildComponent(domNodeRoot);
447 ASSERT_TRUE(boxChild);
448 RefPtr<CheckboxComponent> checkboxComponent = AceType::DynamicCast<CheckboxComponent>(boxChild->GetChild());
449 ASSERT_TRUE(checkboxComponent);
450
451 /**
452 * @tc.steps: step2. Check styles and attributes of created input node.
453 * @tc.expected: step2. The styles and attributes are as expected.
454 */
455 EXPECT_EQ(checkboxComponent->IsDisabled(), true);
456 EXPECT_EQ(checkboxComponent->GetValue(), INPUT_CHECKED_VALUE);
457 EXPECT_EQ(boxChild->GetWidthDimension().Value(), INPUT_WIDTH_VALUE.Value());
458 EXPECT_EQ(boxChild->GetHeightDimension().Value(), INPUT_HEIGHT_VALUE.Value());
459 }
460
461 /**
462 * @tc.name: DomInputCreatorTest009
463 * @tc.desc: Test input component are created with event.
464 * @tc.type: FUNC
465 */
466 HWTEST_F(DomInputTest, DomInputCreatorTest009, TestSize.Level1)
467 {
468 const std::string inputTestJsonStr = "{"
469 " \"tag\": \"input\", "
470 " \"attr\": [{ "
471 " \"type\": \"checkbox\" "
472 " }], "
473 " \"event\": [ "
474 " \"change\" "
475 " ] "
476 "}";
477 /**
478 * @tc.steps: step1. Construct string with event, then create input node with it
479 * @tc.expected: step1. input component are created successfully.
480 */
481 auto domNodeRoot = DOMNodeFactory::GetInstance().CreateDOMNodeFromDsl(inputTestJsonStr);
482 auto boxChild = DOMNodeFactory::GetInstance().GetBoxChildComponent(domNodeRoot);
483 ASSERT_TRUE(boxChild);
484 RefPtr<CheckboxComponent> checkboxComponent = AceType::DynamicCast<CheckboxComponent>(boxChild->GetChild());
485 ASSERT_TRUE(checkboxComponent);
486
487 /**
488 * @tc.steps: step2. Check event of created input node.
489 * @tc.expected: step2. The styles and attributes are as expected.
490 */
491 EXPECT_EQ(checkboxComponent->GetChangeEvent(), std::to_string(domNodeRoot->GetNodeId()));
492 }
493
494 /**
495 * @tc.name: DomInputCreatorTest010
496 * @tc.desc: Test radio component are created as default.
497 * @tc.type: FUNC
498 */
499 HWTEST_F(DomInputTest, DomInputCreatorTest010, TestSize.Level1)
500 {
501 const std::string inputTestJsonStr = "{"
502 " \"tag\": \"input\", "
503 " \"attr\": [{ "
504 " \"type\": \"radio\" "
505 " }] "
506 "}";
507 /**
508 * @tc.steps: step1. Construct string without style and attribute, then create input node with it
509 * @tc.expected: step1. input component are created successfully.
510 */
511 auto domNodeRoot = DOMNodeFactory::GetInstance().CreateDOMNodeFromDsl(inputTestJsonStr);
512 auto boxChild = DOMNodeFactory::GetInstance().GetBoxChildComponent(domNodeRoot);
513 ASSERT_TRUE(boxChild);
514 RefPtr<RadioComponent<std::string>> radioComponent =
515 AceType::DynamicCast<RadioComponent<std::string>>(boxChild->GetChild());
516 ASSERT_TRUE(radioComponent);
517
518 /**
519 * @tc.steps: step2. Check styles and attributes of created input node.
520 * @tc.expected: step2. The styles and attributes are as expected.
521 */
522 RefPtr<CheckboxTheme> theme = THEME_MANAGER->GetTheme<CheckboxTheme>();
523 ASSERT_TRUE(theme);
524
525 EXPECT_EQ(radioComponent->GetWidth(), theme->GetWidth());
526 EXPECT_EQ(radioComponent->GetHeight(), theme->GetHeight());
527 }
528
529 /**
530 * @tc.name: DomInputCreatorTest012
531 * @tc.desc: Test input component are created with event.
532 * @tc.type: FUNC
533 */
534 HWTEST_F(DomInputTest, DomInputCreatorTest012, TestSize.Level1)
535 {
536 const std::string inputTestJsonStr = "{"
537 " \"tag\": \"input\", "
538 " \"attr\": [{ "
539 " \"type\": \"radio\" "
540 " }], "
541 " \"event\": [ \"change\" ] "
542 "}";
543 /**
544 * @tc.steps: step1. Construct string with event, then create input node with it
545 * @tc.expected: step1. input component are created successfully.
546 */
547 auto domNodeRoot = DOMNodeFactory::GetInstance().CreateDOMNodeFromDsl(inputTestJsonStr);
548 auto boxChild = DOMNodeFactory::GetInstance().GetBoxChildComponent(domNodeRoot);
549 ASSERT_TRUE(boxChild);
550 RefPtr<RadioComponent<std::string>> radioComponent =
551 AceType::DynamicCast<RadioComponent<std::string>>(boxChild->GetChild());
552 ASSERT_TRUE(radioComponent);
553
554 /**
555 * @tc.steps: step2. Check event of created input node.
556 * @tc.expected: step2. The styles and attributes are as expected.
557 */
558 EXPECT_EQ(radioComponent->GetChangeEvent(), std::to_string(domNodeRoot->GetNodeId()));
559 }
560
561 } // namespace OHOS::Ace::Framework
562