Project

General

Profile

Feature #26552 » max-width-patch-v4.diff

Added tests - Go MAEDA, 2018-01-10 04:27

View differences:

lib/redmine/wiki_formatting/textile/redcloth3.rb (working copy)
514 514
        atts
515 515
    end
516 516

  
517
    STYLES_RE = /^(color|width|height|border|background|padding|margin|font|text|float)(-[a-z]+)*:\s*((\d+%?|\d+px|\d+(\.\d+)?em|#[0-9a-f]+|[a-z]+)\s*)+$/i
517
    STYLES_RE = /^(color|(min-|max-)?+(width|height)|border|background|padding|margin|font|text|float)(-[a-z]+)*:\s*((\d+%?|\d+px|\d+(\.\d+)?em|#[0-9a-f]+|[a-z]+)\s*)+$/i
518 518

  
519 519
    def sanitize_styles(str)
520 520
      styles = str.split(";").map(&:strip)
test/unit/lib/redmine/wiki_formatting/textile_formatter_test.rb (working copy)
80 80
      'p{border-right:1px}. text'    => '<p style="border-right:1px;">text</p>',
81 81
      'p{border-top:1px}. text'      => '<p style="border-top:1px;">text</p>',
82 82
      'p{border-bottom:1px}. text'   => '<p style="border-bottom:1px;">text</p>',
83
      'p{max-width: 100px}. text'    => '<p style="max-width: 100px;">text</p>',
84
      'p{width: 50px}. text'         => '<p style="width: 50px;">text</p>',
83 85
      }, false)
84 86

  
85 87
    # multiple styles
(4-4/5)