Exemple #1
0
    def test_widgets_dom(self):
        class TestTable(Table):
            class Meta:
                search_placeholder = "test"
                info_format = "__TOTAL__"
                pagination_first = "F"
                pagination_last = "L"
                pagination_prev = "P"
                pagination_next = "N"

        table = TestTable([])
        widgets = TableWidgets(table)
        self.assertEqual(widgets.search_box.placeholder, "test")
        self.assertEqual(widgets.info_label.format, "__TOTAL__")
        self.assertEqual(widgets.pagination.first, "F")
        self.assertEqual(widgets.pagination.last, "L")
        self.assertEqual(widgets.pagination.prev, "P")
        self.assertEqual(widgets.pagination.next, "N")
        self.assertEqual(
            widgets.render_dom(), "<'row'<'col-sm-9 col-md-9 col-lg-9'>"
            "<'col-sm-3 col-md-3 col-lg-3'f>>"
            "rt"
            "<'row'<'col-sm-3 col-md-3 col-lg-3'i>"
            "<'col-sm-6 col-md-6 col-lg-6 col-sm-offset-2 col-md-offset-2 col-lg-offset-2'p>"
            "<'col-sm-1 col-md-1 col-lg-1'l>>")
 def test_widgets_dom(self):
     class TestTable(Table):
         class Meta:
             search_placeholder = "test"
             info_format = "__TOTAL__"
             pagination_first = "F"
             pagination_last = "L"
             pagination_prev = "P"
             pagination_next = "N"
             ext_button = True
             ext_button_template = "foo{{ var }}"
             ext_button_context = {"var": "bar"}
     table = TestTable([])
     widgets = TableWidgets(table)
     self.assertEqual(widgets.search_box.placeholder, "test")
     self.assertEqual(widgets.info_label.format, "__TOTAL__")
     self.assertEqual(widgets.pagination.first, "F")
     self.assertEqual(widgets.pagination.last, "L")
     self.assertEqual(widgets.pagination.prev, "P")
     self.assertEqual(widgets.pagination.next, "N")
     self.assertEqual(widgets.ext_button.html, "foobar")
     self.assertEqual(
         widgets.render_dom(),
         "<'row'<'col-sm-9 col-md-9 col-lg-9 ext-btn'>"
         "<'col-sm-3 col-md-3 col-lg-3'f>>"
         "rt"
         "<'row'<'col-sm-3 col-md-3 col-lg-3'i>"
         "<'col-sm-6 col-md-6 col-lg-6 col-sm-offset-2 col-md-offset-2 col-lg-offset-2'p>"
         "<'col-sm-1 col-md-1 col-lg-1'l>>"
     )
    def test_widgets_dom(self):
        class TestTable(Table):
            class Meta:
                search_placeholder = "test"
                info_format = "__TOTAL__"
                pagination_first = "F"
                pagination_last = "L"
                pagination_prev = "P"
                pagination_next = "N"
                ext_button = True
                ext_button_template = "foo{{ var }}"
                ext_button_context = {"var": "bar"}

        table = TestTable([])
        widgets = TableWidgets(table)
        self.assertEqual(widgets.search_box.placeholder, "test")
        self.assertEqual(widgets.info_label.format, "__TOTAL__")
        self.assertEqual(widgets.pagination.first, "F")
        self.assertEqual(widgets.pagination.last, "L")
        self.assertEqual(widgets.pagination.prev, "P")
        self.assertEqual(widgets.pagination.__next__, "N")
        self.assertEqual(widgets.ext_button.html, "foobar")
        self.assertEqual(
            widgets.render_dom(),
            "<'row'<'col-sm-9 col-md-9 col-lg-9 ext-btn'>"
            "<'col-sm-3 col-md-3 col-lg-3'f>>"
            "rt"
            "<'row'<'col-sm-3 col-md-3 col-lg-3'i>"
            "<'col-sm-6 col-md-6 col-lg-6 col-sm-offset-2 col-md-offset-2 col-lg-offset-2'p>"
            "<'col-sm-1 col-md-1 col-lg-1'l>>")
    def test_widgets_dom(self):
        class TestTable(Table):
            class Meta:
                search_placeholder = "test"
                info_format = "__TOTAL__"
                pagination_first = "F"
                pagination_last = "L"
                pagination_prev = "P"
                pagination_next = "N"

        table = TestTable([])
        widgets = TableWidgets(table)
        self.assertEqual(widgets.search_box.placeholder, "test")
        self.assertEqual(widgets.info_label.format, "__TOTAL__")
        self.assertEqual(widgets.pagination.first, "F")
        self.assertEqual(widgets.pagination.last, "L")
        self.assertEqual(widgets.pagination.prev, "P")
        self.assertEqual(widgets.pagination.next, "N")
        self.assertEqual(
            widgets.render_dom(),
            "<'row'<'col-sm-9 col-md-9 col-lg-9'>"
            "<'col-sm-3 col-md-3 col-lg-3'f>>"
            "rt"
            "<'row'<'col-sm-3 col-md-3 col-lg-3'i>"
            "<'col-sm-6 col-md-6 col-lg-6 col-sm-offset-2 col-md-offset-2 col-lg-offset-2'p>"
            "<'col-sm-1 col-md-1 col-lg-1'l>>"
        )
 def test_widgets_dom_simple(self):
     class SimpleTable(Table):
         class Meta:
             search = False
             pagination = False
             info = False
             length_menu = False
     table = SimpleTable([])
     widgets = TableWidgets(table)
     self.assertEqual(widgets.render_dom(), "rt")
Exemple #6
0
    def test_widgets_dom_simple(self):
        class SimpleTable(Table):
            class Meta:
                search = False
                pagination = False
                info = False
                length_menu = False

        table = SimpleTable([])
        widgets = TableWidgets(table)
        self.assertEqual(widgets.render_dom(), "rt")