Changeset 3984


Ignore:
Timestamp:
05/27/09 19:14:48 (3 years ago)
Author:
MichaelTempest
Message:

Item1666: Process the WYSIWYG_COLOR class, when applied to tags other than span and font (which worked already)

Add unit tests for WYSIWYG_COLOR class, applied to other tags, also in combination with the WYSIWYG_TT class.

Add unit tests for list types and verbatim nbsp

Location:
trunk/WysiwygPlugin
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/WysiwygPlugin/lib/Foswiki/Plugins/WysiwygPlugin/HTML2TML/Node.pm

    r3947 r3984  
    455455    { 
    456456 
     457                my %new_attrs = ( class => $class ); 
     458        $new_attrs{style} = $this->{attrs}->{style} 
     459          if exists $this->{attrs}->{style}; 
    457460        my $newspan = 
    458461          new Foswiki::Plugins::WysiwygPlugin::HTML2TML::Node( $this->{context}, 
    459             'span', { class => $class } ); 
     462            'span', \%new_attrs ); 
    460463        my $kid = $this->{head}; 
    461464        while ($kid) { 
     
    512515 
    513516    $this->_moveClassToSpan('WYSIWYG_TT'); 
     517    $this->_moveClassToSpan('WYSIWYG_COLOR') 
     518      if lc( $this->{tag} ) ne 'font'; 
    514519 
    515520    # See if we have a TML translation function for this tag 
     
    865870        if ( $kid->{tag} eq 'th' ) { 
    866871            $kid->_moveClassToSpan('WYSIWYG_TT'); 
     872            $kid->_moveClassToSpan('WYSIWYG_COLOR'); 
    867873            ( $flags, $text ) = $kid->_flatten($options); 
    868874            $text = _TDtrim($text); 
     
    871877        elsif ( $kid->{tag} eq 'td' ) { 
    872878            $kid->_moveClassToSpan('WYSIWYG_TT'); 
     879            $kid->_moveClassToSpan('WYSIWYG_COLOR'); 
    873880            ( $flags, $text ) = $kid->_flatten($options); 
    874881            $text = _TDtrim($text); 
  • trunk/WysiwygPlugin/test/unit/WysiwygPlugin/TranslatorTests.pm

    r3947 r3984  
    223223BLAH 
    224224        tml => '==Code==' 
     225    }, 
     226    { 
     227        exec => $HTML2TML | $ROUNDTRIP, 
     228        name => 'strongWithTtAndColorClasses', 
     229        html => <<'BLAH', 
     230<p> 
     231<strong class="WYSIWYG_TT WYSIWYG_COLOR" style="color:#FF0000;">Code</strong> 
     232</p> 
     233BLAH 
     234                tml => '*%RED% =Code= %ENDCOLOR%*' 
    225235    }, 
    226236    { 
     
    422432    }, 
    423433    { 
     434        exec => $TML2HTML | $ROUNDTRIP, 
     435        name => 'orderedList_Item1341', 
     436        html => <<'HERE', 
     437<ol><li>Sushi</li><li>Banana</li></ol><p /> 
     438<ol><li type="A">Sushi</li><li type="A">Banana</li></ol><p /> 
     439<ol><li type="i">Sushi</li><li type="i">Banana</li></ol><p /> 
     440<ol><li type="I">Sushi</li><li type="I">Banana</li></ol><p /> 
     441<ol><li>Sushi</li><li type="A">Sushi</li><li type="i">Sushi</li></ol> 
     442HERE 
     443        tml => <<'HERE', 
     444   1 Sushi 
     445   1 Banana 
     446 
     447   A. Sushi 
     448   A. Banana 
     449 
     450   i. Sushi 
     451   i. Banana 
     452 
     453   I. Sushi 
     454   I. Banana 
     455 
     456   1 Sushi 
     457   A. Sushi 
     458   i. Sushi 
     459HERE 
     460    }, 
     461    { 
    424462        exec => $ROUNDTRIP, 
    425463        name => 'mixedList', 
     
    838876 </verbatim> Outside', 
    839877    }, 
     878        { 
     879                exec => $TML2HTML | $ROUNDTRIP, 
     880                name => 'verbatimWithNbsp1554', 
     881                html => '<p><pre class="TMLverbatim">&amp;nbsp;</pre></p>', 
     882                tml => "<verbatim>&nbsp;</verbatim>" 
     883        }, 
    840884    { 
    841885        exec => $TML2HTML | $ROUNDTRIP, 
     
    16731717        html => 'the <tt><tt>co</tt>mple<code>te</code></tt> table', 
    16741718        tml  => 'the =complete= table', 
     1719    }, 
     1720    { 
     1721        exec => $HTML2TML, 
     1722        name => 'strongWithColorClass', 
     1723        html => <<'BLAH', 
     1724<p> 
     1725<strong class="WYSIWYG_COLOR" style="color:#FF0000;">Strong red</strong> 
     1726</p> 
     1727BLAH 
     1728        tml => '*%RED%Strong red%ENDCOLOR%*' 
     1729    }, 
     1730    { 
     1731        exec => $HTML2TML | $ROUNDTRIP, 
     1732        name => 'colorClassInTable', 
     1733        html => <<'BLAH', 
     1734<table> 
     1735<tr><th class="WYSIWYG_COLOR" style="color:#FF0000;">Red Heading</th></tr> 
     1736<tr><td class="WYSIWYG_COLOR" style="color:#FF0000;">Red herring</td></tr> 
     1737</table> 
     1738BLAH 
     1739        tml  => <<'BLAH', 
     1740| *%RED%Red Heading%ENDCOLOR%* | 
     1741| %RED%Red herring%ENDCOLOR% | 
     1742BLAH 
     1743    }, 
     1744    { 
     1745        exec => $HTML2TML | $ROUNDTRIP, 
     1746        name => 'colorAndTtClassInTable', 
     1747        html => <<'BLAH', 
     1748<table> 
     1749<tr><th class="WYSIWYG_COLOR WYSIWYG_TT" style="color:#FF0000;">Redder code</th></tr> 
     1750<tr><td class="WYSIWYG_COLOR WYSIWYG_TT" style="color:#FF0000;">Red code</td></tr> 
     1751</table> 
     1752BLAH 
     1753        tml  => <<'BLAH', 
     1754| *%RED% =Redder code= %ENDCOLOR%* | 
     1755| %RED% =Red code= %ENDCOLOR% | 
     1756BLAH 
    16751757    }, 
    16761758    { 
Note: See TracChangeset for help on using the changeset viewer.