Пример #1
0
    def test_text_resource_parameter_html_element_with_placeholder(self):
        param = TextResourceParameter(name="option1", placeholder="placeholder text")
        html = param.html_element()
        self.assertIsInstance(html, etree._Element)

        self.assertEqual("fieldset", html.tag)
        self.assertEqual(2, len(html))  # legend and input
        self.assertEqual("legend", html[0].tag)

        self.assertEqual("input", html[1].tag)
        self.assertEqual("option1", html[1].get("name"))
        self.assertEqual("placeholder text", html[1].get("placeholder"))
        self.assertEqual("text", html[1].get("type"))
Пример #2
0
    def get_local_options(cls):
        """Get local options dictionary, including additional subclass local options.

        These options are only included when running locally.

        Returns:
            Dictionary, of form {option name: ResourceParameter object, ...}
        """
        local_options = cls.get_additional_local_options()
        local_options = {
            "header_text":
            TextResourceParameter(name="header_text",
                                  description=_("Header Text"),
                                  placeholder=_("Example School: Room Four"),
                                  required=False),
        }
        if cls.copies:
            local_options.update({
                "copies":
                IntegerResourceParameter(name="copies",
                                         description=_("Number of Copies"),
                                         min_val=1,
                                         max_val=50,
                                         default=1,
                                         required=False),
            })
        return local_options
Пример #3
0
 def get_additional_options(cls):
     """Add option that is not an EnumResourceParameter."""
     return {
         "header_text":
         TextResourceParameter(name="header_text",
                               description="Header Text",
                               placeholder="Example School: Room Four",
                               required=False),
     }