Beispiel #1
0
class TestLinesField(ERP5TypeTestCase):
    def getTitle(self):
        return "Lines Field"

    def afterSetUp(self):
        self.field = LinesField("test_field")
        self.widget = self.field.widget

    def test_render_view(self):
        self.assertEqual(
            self.field.render_view(value=["My first Line\n", "&My Second Line\tfoo"]),
            "<div  >\nMy first Line<br />\n<br />\n&amp;My Second Line\tfoo</div>",
        )

    def test_render_odt(self):
        self.field.values["default"] = ["A", "B"]
        self.assertEqual("{%(text)s}p" % NSMAP, self.field.render_odt(as_string=False).tag)

    def test_render_odt_view(self):
        self.field.values["default"] = ["A", "B"]
        element = self.field.render_odt(as_string=False, REQUEST=self.portal.REQUEST)
        self.assertEqual("{%(text)s}p" % NSMAP, element.tag)
        # separated by text:line-break
        self.assertEqual("{%(text)s}line-break" % NSMAP, element[0].tag)
        self.assertEqual(["A", "B"], [x for x in element.itertext()])
Beispiel #2
0
class TestLinesField(ERP5TypeTestCase):

  def getTitle(self):
    return "Lines Field"

  def afterSetUp(self):
    self.field = LinesField('test_field')
    self.widget = self.field.widget

  def test_render_view(self):
    self.assertEquals(self.field.render_view(value=['My first Line\n', '&My Second Line\tfoo']),
                      '<div  >\nMy first Line<br />\n<br />\n&amp;My Second Line\tfoo</div>')

  def test_render_odt(self):
    self.field.values['default'] = ['A', 'B']
    self.assertEquals('{%(text)s}p' % NSMAP,
                      self.field.render_odt(as_string=False).tag)

  def test_render_odt_view(self):
    self.field.values['default'] = ['A', 'B']
    element = self.field.render_odt(as_string=False,
                                    REQUEST=self.portal.REQUEST)
    self.assertEquals('{%(text)s}p' % NSMAP, element.tag)
    # separated by text:line-break
    self.assertEquals('{%(text)s}line-break' % NSMAP, element[0].tag)
    self.assertEquals(['A', 'B'], [x for x in element.itertext()])
Beispiel #3
0
class TestLinesField(ERP5TypeTestCase):
    def getTitle(self):
        return "Lines Field"

    def afterSetUp(self):
        self.field = LinesField('test_field')
        self.widget = self.field.widget

    def test_render_view(self):
        self.assertEqual(
            self.field.render_view(
                value=['My first Line\n', '&My Second Line\tfoo']),
            '<div  >My first Line<br />\n<br />\n&amp;My Second Line\tfoo</div>'
        )

    def test_render_odt(self):
        self.field.values['default'] = ['A', 'B']
        self.assertEqual('{%(text)s}p' % NSMAP,
                         self.field.render_odt(as_string=False).tag)

    def test_render_odt_view(self):
        self.field.values['default'] = ['A', 'B']
        element = self.field.render_odt(as_string=False,
                                        REQUEST=self.portal.REQUEST)
        self.assertEqual('{%(text)s}p' % NSMAP, element.tag)
        # separated by text:line-break
        self.assertEqual('{%(text)s}line-break' % NSMAP, element[0].tag)
        self.assertEqual(['A', 'B'], [x for x in element.itertext()])
Beispiel #4
0
 def afterSetUp(self):
     self.field = LinesField("test_field")
     self.widget = self.field.widget
Beispiel #5
0
 def afterSetUp(self):
     self.field = LinesField('test_field')
     self.widget = self.field.widget