コード例 #1
0
ファイル: s3widgets.py プロジェクト: ursea/eden
    def testWidget(self):
        # Test the widget method
        field = Storage(name="f",
                        type="list:reference t_able",
                        requires=IS_IN_SET({
                            1: "One",
                            2: "Two"
                        }, multiple=True))

        # default options
        widget = s3_grouped_checkboxes_widget(field, [])
        self.assertEqual(str(widget), str(s3_checkboxes_widget(field, [])))

        # small group size
        widget = s3_grouped_checkboxes_widget(field, [], size=1)

        f1 = Storage(name="f",
                     type="list:reference t_able",
                     requires=IS_IN_SET({1: "One"}, multiple=True))
        f2 = Storage(name="f",
                     type="list:reference t_able",
                     requires=IS_IN_SET({2: "Two"}, multiple=True))
        self.assertEqual(
            str(widget),
            str(TAG[""](DIV(DIV("A - O",
                                _class="s3-grouped-checkboxes-widget-label",
                                _id="f-group-label-0"),
                            s3_checkboxes_widget(f1, []),
                            DIV("T - Z",
                                _class="s3-grouped-checkboxes-widget-label",
                                _id="f-group-label-1"),
                            s3_checkboxes_widget(f2, [], start_at_id=1),
                            _class="s3-grouped-checkboxes-widget"))))
コード例 #2
0
    def testWidget(self):
        # Test the widget method
        field = Storage(name="f", type="list:reference t_able", requires=IS_IN_SET({1: "One", 2: "Two"}, multiple=True))

        # default options
        widget = s3_grouped_checkboxes_widget(field, [])
        self.assertEqual(str(widget), str(s3_checkboxes_widget(field, [])))

        # small group size
        widget = s3_grouped_checkboxes_widget(field, [], size=1)

        f1 = Storage(name="f", type="list:reference t_able", requires=IS_IN_SET({1: "One"}, multiple=True))
        f2 = Storage(name="f", type="list:reference t_able", requires=IS_IN_SET({2: "Two"}, multiple=True))
        self.assertEqual(
            str(widget),
            str(
                TAG[""](
                    DIV(
                        DIV("A - O", _class="s3-grouped-checkboxes-widget-label expanded", _id="f-group-label-0"),
                        s3_checkboxes_widget(f1, []),
                        DIV("T - Z", _class="s3-grouped-checkboxes-widget-label expanded", _id="f-group-label-1"),
                        s3_checkboxes_widget(f2, [], start_at_id=1),
                        _class="s3-grouped-checkboxes-widget",
                        _name="f_widget",
                    )
                )
            ),
        )