use of com.yandex.money.api.model.showcase.components.uicontrols.Submit in project yandex-money-sdk-java by yandex-money.
the class ShowcaseParserTest method checkForm.
private void checkForm(Group form) {
assertNotNull(form);
assertEquals(form.layout, Group.Layout.VERTICAL);
List<Component> components = form.items;
assertEquals(components.size(), 13);
Component component = components.get(0);
assertTrue(component instanceof Text);
Text text = (Text) component;
assertEquals(text.valueAutoFill, Parameter.AutoFill.CURRENT_USER_ACCOUNT);
checkComponentFields(text, "name1", "required");
assertEquals(text.minLength, Integer.valueOf(2));
assertEquals(text.maxLength, Integer.valueOf(10));
assertEquals(text.pattern, "\\D*?");
component = components.get(1);
assertTrue(component instanceof Number);
Number number = (Number) component;
checkComponentFields(number, "name2", "10.00");
checkNumberField(number);
component = components.get(2);
assertTrue(component instanceof Amount);
Amount amount = (Amount) component;
checkComponentFields(amount, "name3", "10.00");
checkNumberField(amount);
assertEquals(amount.currency, Currency.RUB);
checkFee(amount.fee);
component = components.get(3);
assertTrue(component instanceof Email);
checkComponentFields(component, "name4", "vyasevich@yamoney.ru");
component = components.get(4);
assertTrue(component instanceof Tel);
checkComponentFields(component, "name5", "79876543210");
component = components.get(5);
assertTrue(component instanceof Checkbox);
Checkbox checkbox = (Checkbox) component;
checkComponentFields(component, "name6", "true");
assertTrue(checkbox.checked);
component = components.get(6);
assertTrue(component instanceof Date);
Date date = (Date) component;
checkComponentFields(date, "name7", "2005-01-01");
checkDate(date);
component = components.get(7);
assertTrue(component instanceof Month);
Month month = (Month) component;
checkComponentFields(month, "name8", "2005-01");
checkDate(month);
component = components.get(8);
assertTrue(component instanceof Select);
Select select = (Select) component;
checkComponentFields(select, "name9", "value2");
assertEquals(select.style, Select.Style.RADIO_GROUP);
checkOptions(select.options);
component = components.get(9);
assertTrue(component instanceof TextArea);
TextArea textArea = (TextArea) component;
checkComponentFields(textArea, "name10", "value");
assertEquals(textArea.minLength, Integer.valueOf(2));
assertEquals(textArea.maxLength, Integer.valueOf(10));
component = components.get(10);
assertTrue(component instanceof Submit);
Submit submit = (Submit) component;
assertEquals(submit.hint, "hint");
assertEquals(submit.label, "label");
assertEquals(submit.alert, "alert");
assertTrue(submit.required);
assertFalse(submit.readonly);
component = components.get(11);
assertTrue(component instanceof Group);
Group group = (Group) component;
assertEquals(group.label, "label");
assertEquals(group.layout, Group.Layout.HORIZONTAL);
assertNotNull(group.items);
assertEquals(group.items.size(), 2);
component = components.get(12);
assertTrue(component instanceof Paragraph);
Paragraph paragraph = (Paragraph) component;
assertEquals(paragraph.label, "label");
List<TextBlock> items = paragraph.items;
assertNotNull(items);
assertEquals(items.size(), 3);
TextBlock block = items.get(0);
assertEquals(block.text, "Text with ");
block = items.get(1);
assertEquals(block.text, "link");
assertTrue(block instanceof TextBlock.WithLink);
TextBlock.WithLink link = (TextBlock.WithLink) block;
assertEquals(link.link, "https://money.yandex.ru");
block = items.get(2);
assertEquals(block.text, ".");
}
Aggregations