- Timestamp:
- 11/18/09 06:27:14 (3 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/WysiwygPlugin/test/unit/WysiwygPlugin/ExtendedTranslatorTests.pm
r5240 r5573 36 36 # Bits for test type 37 37 # Fields in test records: 38 my $TML2HTML = 1 << 0;# test tml => html39 my $HTML2TML = 1 << 1;# test html => finaltml (default tml)40 my $ROUNDTRIP = 1 << 2;# test tml => => finaltml38 my $TML2HTML = 1 << 0; # test tml => html 39 my $HTML2TML = 1 << 1; # test html => finaltml (default tml) 40 my $ROUNDTRIP = 1 << 2; # test tml => => finaltml 41 41 my $CANNOTWYSIWYG = 1 << 3; # test that notWysiwygEditable returns true 42 42 # and make the ROUNDTRIP test expect failure … … 61 61 # is "WysiwygEditable". 62 62 # 63 # Use CANNOTWYSIWYG without ROUNDTRIP *only* with an appropriate 64 # explanation. For example: 63 # Use CANNOTWYSIWYG without ROUNDTRIP *only* with an appropriate 64 # explanation. For example: 65 65 # Can't ROUNDTRIP this TML because perl on the SMURF platform 66 66 # automagically replaces all instances of 'blue' with 'beautiful'. … … 85 85 # Each testcase is a subhash with fields as follows: 86 86 # exec => $TML2HTML to test TML -> HTML, $HTML2TML to test HTML -> TML, 87 # $ROUNDTRIP to test TML-> ->TML, $CANNOTWYSIWYG to test 87 # $ROUNDTRIP to test TML-> ->TML, $CANNOTWYSIWYG to test 88 88 # notWysiwygEditable, all other bits are ignored. 89 89 # They may be OR'd togoether to perform multiple tests. … … 102 102 my $data = [ 103 103 { 104 exec => $TML2HTML | $ROUNDTRIP, 105 name => 'UnspecifiedCustomXmlTag', 106 setup => sub { 107 $extraTML2HTMLOptions{xmltag} = \%Foswiki::Plugins::WysiwygPlugin::xmltag; 104 exec => $TML2HTML | $ROUNDTRIP, 105 name => 'UnspecifiedCustomXmlTag', 106 setup => sub { 107 $extraTML2HTMLOptions{xmltag} = 108 \%Foswiki::Plugins::WysiwygPlugin::xmltag; 108 109 }, 109 110 html => '<p>' … … 122 123 name => 'DisabledCustomXmlTag', 123 124 setup => sub { 124 $extraTML2HTMLOptions{xmltag} = \%Foswiki::Plugins::WysiwygPlugin::xmltag; 125 $extraTML2HTMLOptions{xmltag} = 126 \%Foswiki::Plugins::WysiwygPlugin::xmltag; 125 127 Foswiki::Plugins::WysiwygPlugin::addXMLTag( 'customtag', 126 128 sub { 0 } ); … … 141 143 name => 'CustomXmlTag', 142 144 setup => sub { 143 $extraTML2HTMLOptions{xmltag} = \%Foswiki::Plugins::WysiwygPlugin::xmltag; 145 $extraTML2HTMLOptions{xmltag} = 146 \%Foswiki::Plugins::WysiwygPlugin::xmltag; 144 147 Foswiki::Plugins::WysiwygPlugin::addXMLTag( 'customtag', 145 148 sub { 1 } ); … … 155 158 name => 'CustomXmlTagCallbackChangesText', 156 159 setup => sub { 157 $extraTML2HTMLOptions{xmltag} = \%Foswiki::Plugins::WysiwygPlugin::xmltag; 160 $extraTML2HTMLOptions{xmltag} = 161 \%Foswiki::Plugins::WysiwygPlugin::xmltag; 158 162 Foswiki::Plugins::WysiwygPlugin::addXMLTag( 'customtag', 159 163 sub { $_[0] =~ s/some/different/; return 1; } ); … … 170 174 name => 'CustomXmlTagDefaultCallback', 171 175 setup => sub { 172 $extraTML2HTMLOptions{xmltag} = \%Foswiki::Plugins::WysiwygPlugin::xmltag; 173 Foswiki::Plugins::WysiwygPlugin::addXMLTag( 'customtag' ); 176 $extraTML2HTMLOptions{xmltag} = 177 \%Foswiki::Plugins::WysiwygPlugin::xmltag; 178 Foswiki::Plugins::WysiwygPlugin::addXMLTag('customtag'); 174 179 }, 175 180 html => '<p>' … … 183 188 name => 'CustomXmlTagWithAttributes', 184 189 setup => sub { 185 $extraTML2HTMLOptions{xmltag} = \%Foswiki::Plugins::WysiwygPlugin::xmltag; 190 $extraTML2HTMLOptions{xmltag} = 191 \%Foswiki::Plugins::WysiwygPlugin::xmltag; 186 192 Foswiki::Plugins::WysiwygPlugin::addXMLTag( 'customtag', 187 193 sub { 1 } ); … … 201 207 name => 'NestedCustomXmlTagWithAttributes', 202 208 setup => sub { 203 $extraTML2HTMLOptions{xmltag} = \%Foswiki::Plugins::WysiwygPlugin::xmltag; 209 $extraTML2HTMLOptions{xmltag} = 210 \%Foswiki::Plugins::WysiwygPlugin::xmltag; 204 211 Foswiki::Plugins::WysiwygPlugin::addXMLTag( 'customtag', 205 212 sub { 1 } ); … … 226 233 { 227 234 exec => $CANNOTWYSIWYG, 235 228 236 # Do not perform ROUNDTRIP on this TML, because ROUNDTRIP passes. 229 # The problem with this TML is that the special handling of 230 # <verbatim> in the conversion to HTML messes up the contents 231 # of this custom XML tag, so that the HTML is not representative 237 # The problem with this TML is that the special handling of 238 # <verbatim> in the conversion to HTML messes up the contents 239 # of this custom XML tag, so that the HTML is not representative 232 240 # of the TML in terms of intellectual content. 233 name => 'VerbatimInsideDot',234 setup => sub { 235 $extraTML2HTMLOptions{xmltag} = \%Foswiki::Plugins::WysiwygPlugin::xmltag;236 Foswiki::Plugins::WysiwygPlugin::addXMLTag( 'dot',237 sub { 1 } );241 name => 'VerbatimInsideDot', 242 setup => sub { 243 $extraTML2HTMLOptions{xmltag} = 244 \%Foswiki::Plugins::WysiwygPlugin::xmltag; 245 Foswiki::Plugins::WysiwygPlugin::addXMLTag( 'dot', sub { 1 } ); 238 246 }, 239 247 tml => <<'DOT', … … 249 257 }, 250 258 { 251 exec => $TML2HTML | $ROUNDTRIP, 252 name => 'CustomtagInsideSticky', 253 setup => sub { 254 $extraTML2HTMLOptions{xmltag} = \%Foswiki::Plugins::WysiwygPlugin::xmltag; 259 exec => $TML2HTML | $ROUNDTRIP, 260 name => 'CustomtagInsideSticky', 261 setup => sub { 262 $extraTML2HTMLOptions{xmltag} = 263 \%Foswiki::Plugins::WysiwygPlugin::xmltag; 255 264 Foswiki::Plugins::WysiwygPlugin::addXMLTag( 'customtag', 256 265 sub { 1 } ); 257 266 }, 258 tml => "<sticky><customtag>this & that\n > the other </customtag></sticky>", 267 tml => 268 "<sticky><customtag>this & that\n > the other </customtag></sticky>", 259 269 html => '<p>' 260 270 . '<div class="WYSIWYG_STICKY">' … … 262 272 . 'this & that<br /> > the other ' 263 273 . '</customtag>' 264 . '</div>' 265 . '</p>'266 },267 {268 exec => $ROUNDTRIP | $CANNOTWYSIWYG, #SMELL: fix this case269 name => 'StickyInsideCustomtag',270 setup => sub {271 $extraTML2HTMLOptions{xmltag} =\%Foswiki::Plugins::WysiwygPlugin::xmltag;274 . '</div>' . '</p>' 275 }, 276 { 277 exec => $ROUNDTRIP | $CANNOTWYSIWYG, #SMELL: fix this case 278 name => 'StickyInsideCustomtag', 279 setup => sub { 280 $extraTML2HTMLOptions{xmltag} = 281 \%Foswiki::Plugins::WysiwygPlugin::xmltag; 272 282 Foswiki::Plugins::WysiwygPlugin::addXMLTag( 'customtag', 273 283 sub { 1 } ); 274 284 }, 275 tml => "<customtag>this <sticky>& that\n > the</sticky> other </customtag>", 285 tml => 286 "<customtag>this <sticky>& that\n > the</sticky> other </customtag>", 276 287 html => '<p>' 277 288 . $protecton … … 283 294 . ' other ' 284 295 . '</customtag>' 285 . $protectoff 286 . '</p>' 287 }, 288 { 289 exec => $TML2HTML | $ROUNDTRIP, 290 name => 'StickyInsideUnspecifiedCustomtag', 291 setup => sub { 292 $extraTML2HTMLOptions{xmltag} = \%Foswiki::Plugins::WysiwygPlugin::xmltag; 293 }, 294 tml => "<customtag>this <sticky>& that\n > the</sticky> other </customtag>", 296 . $protectoff . '</p>' 297 }, 298 { 299 exec => $TML2HTML | $ROUNDTRIP, 300 name => 'StickyInsideUnspecifiedCustomtag', 301 setup => sub { 302 $extraTML2HTMLOptions{xmltag} = 303 \%Foswiki::Plugins::WysiwygPlugin::xmltag; 304 }, 305 tml => 306 "<customtag>this <sticky>& that\n > the</sticky> other </customtag>", 295 307 html => '<p>' 296 308 . $protecton 297 309 . '<customtag>' 298 . $protectoff 299 . 'this' 310 . $protectoff . 'this' 300 311 . '<div class="WYSIWYG_STICKY">' 301 312 . '& that<br /> > the' 302 . '</div>' 303 . 'other' 313 . '</div>' . 'other' 304 314 . $protecton 305 315 . '</customtag>' 306 . $protectoff 307 . '</p>' 308 }, 309 { 310 exec => $ROUNDTRIP, 311 name => 'UnspecifiedCustomtagInsideSticky', 312 setup => sub { 313 $extraTML2HTMLOptions{xmltag} = \%Foswiki::Plugins::WysiwygPlugin::xmltag; 314 }, 315 tml => "<sticky><customtag>this & that\n > the other </customtag></sticky>" 316 }, 317 { 318 exec => $TML2HTML | $ROUNDTRIP, 319 name => 'CustomtagInsideLiteral', 320 setup => sub { 321 $extraTML2HTMLOptions{xmltag} = \%Foswiki::Plugins::WysiwygPlugin::xmltag; 316 . $protectoff . '</p>' 317 }, 318 { 319 exec => $ROUNDTRIP, 320 name => 'UnspecifiedCustomtagInsideSticky', 321 setup => sub { 322 $extraTML2HTMLOptions{xmltag} = 323 \%Foswiki::Plugins::WysiwygPlugin::xmltag; 324 }, 325 tml => 326 "<sticky><customtag>this & that\n > the other </customtag></sticky>" 327 }, 328 { 329 exec => $TML2HTML | $ROUNDTRIP, 330 name => 'CustomtagInsideLiteral', 331 setup => sub { 332 $extraTML2HTMLOptions{xmltag} = 333 \%Foswiki::Plugins::WysiwygPlugin::xmltag; 322 334 Foswiki::Plugins::WysiwygPlugin::addXMLTag( 'customtag', 323 335 sub { 1 } ); 324 336 }, 325 tml => '<literal><customtag>this & that > the other </customtag></literal>', 337 tml => 338 '<literal><customtag>this & that > the other </customtag></literal>', 326 339 html => '<p>' 327 340 . '<div class="WYSIWYG_LITERAL">' 328 341 . '<customtag>this & that > the other </customtag>' 329 . '</div>' 330 . '</p>' 331 }, 332 { 333 exec => $TML2HTML | $ROUNDTRIP, 334 name => 'UnspecifiedCustomtagInsideLiteral', 335 setup => sub { 336 $extraTML2HTMLOptions{xmltag} = \%Foswiki::Plugins::WysiwygPlugin::xmltag; 337 }, 338 tml => '<literal><customtag>this & that > the other </customtag></literal>', 342 . '</div>' . '</p>' 343 }, 344 { 345 exec => $TML2HTML | $ROUNDTRIP, 346 name => 'UnspecifiedCustomtagInsideLiteral', 347 setup => sub { 348 $extraTML2HTMLOptions{xmltag} = 349 \%Foswiki::Plugins::WysiwygPlugin::xmltag; 350 }, 351 tml => 352 '<literal><customtag>this & that > the other </customtag></literal>', 339 353 html => '<p>' 340 354 . '<div class="WYSIWYG_LITERAL">' 341 355 . '<customtag>this & that > the other </customtag>' 342 . '</div>' 343 . '</p>'344 },345 {346 exec => $ROUNDTRIP | $CANNOTWYSIWYG, #SMELL: Fix this case347 name => 'LiteralInsideCustomtag',348 setup => sub {349 $extraTML2HTMLOptions{xmltag} =\%Foswiki::Plugins::WysiwygPlugin::xmltag;356 . '</div>' . '</p>' 357 }, 358 { 359 exec => $ROUNDTRIP | $CANNOTWYSIWYG, #SMELL: Fix this case 360 name => 'LiteralInsideCustomtag', 361 setup => sub { 362 $extraTML2HTMLOptions{xmltag} = 363 \%Foswiki::Plugins::WysiwygPlugin::xmltag; 350 364 Foswiki::Plugins::WysiwygPlugin::addXMLTag( 'customtag', 351 365 sub { 1 } ); 352 366 }, 353 tml => '<customtag>this <literal>& that > the</literal> other </customtag>', 367 tml => 368 '<customtag>this <literal>& that > the</literal> other </customtag>', 354 369 html => '<p>' 355 370 . '<div class="WYSIWYG_LITERAL">' 356 371 . '<customtag>this & that > the other </customtag>' 357 . '</div>' 358 . '</p>' 359 }, 360 { 361 exec => $TML2HTML | $ROUNDTRIP, 362 name => 'LiteralInsideUnspecifiedCustomtag', 363 setup => sub { 364 $extraTML2HTMLOptions{xmltag} = \%Foswiki::Plugins::WysiwygPlugin::xmltag; 365 }, 366 tml => '<customtag>this <literal>& that > the</literal> other </customtag>', 372 . '</div>' . '</p>' 373 }, 374 { 375 exec => $TML2HTML | $ROUNDTRIP, 376 name => 'LiteralInsideUnspecifiedCustomtag', 377 setup => sub { 378 $extraTML2HTMLOptions{xmltag} = 379 \%Foswiki::Plugins::WysiwygPlugin::xmltag; 380 }, 381 tml => 382 '<customtag>this <literal>& that > the</literal> other </customtag>', 367 383 html => '<p>' 368 384 . $protecton 369 385 . '<customtag>' 370 . $protectoff 371 . 'this' 386 . $protectoff . 'this' 372 387 . '<div class="WYSIWYG_LITERAL">' 373 388 . '& that > the' 374 . '</div>' 375 .'other' 389 . '</div>' . 'other' 376 390 . $protecton 377 391 . '</customtag>' 378 . $protectoff 379 . '</p>' 380 }, 381 { 382 # There will probably always be some markup that WysiwygPlugin cannot convert, 383 # but it is not always easy to say what that markup is. 384 # This test case checks the protection of unconvertable text 385 # by using valid markup and forcing the conversion to fail. 392 . $protectoff . '</p>' 393 }, 394 { 395 396 # There will probably always be some markup that WysiwygPlugin cannot convert, 397 # but it is not always easy to say what that markup is. 398 # This test case checks the protection of unconvertable text 399 # by using valid markup and forcing the conversion to fail. 400 exec => $TML2HTML | $ROUNDTRIP, 401 name => 'UnconvertableTextIsProtected', 402 setup => sub { 403 404 # Disable "dieOnError" to test the "protect unconvertable text" behaviour 405 # which can be exercised via the REST handler 406 $extraTML2HTMLOptions{dieOnError} = 0; 407 408 # Override the standard expansion function to hack in an illegal character to force the conversion to fail 409 $extraTML2HTMLOptions{expandVarsInURL} = sub { return "\0"; }; 410 }, 411 tml => '<img src="%PUBURLPATH%">', 412 html => 413 '<div class="WYSIWYG_PROTECTED"><img src="%PUBURLPATH%"></div>' 414 }, 415 { 416 exec => $HTML2TML | $ROUNDTRIP, 417 name => 'TableWithRowSpan_NoTablePlugin', 418 setup => 419 sub { Foswiki::Func::getContext()->{'TablePluginEnabled'} = 0; }, 420 html => <<HTML, 421 <table cellspacing="1" cellpadding="0" border="1"> 422 <tr><td rowspan="2">A</td><td rowspan="3">B</td><td>X</td></tr> 423 <tr><td rowspan="2">C</td></tr> 424 <tr><td>M</td></tr> 425 </table> 426 HTML 427 tml => <<TML, 428 <table cellspacing="1" cellpadding="0" border="1"> <tr><td rowspan="2">A</td><td rowspan="3">B</td><td>X</td></tr> <tr><td rowspan="2">C</td></tr> <tr><td>M</td></tr> </table> 429 TML 430 }, 431 { 386 432 exec => $TML2HTML | $ROUNDTRIP, 387 name => 'UnconvertableTextIsProtected', 388 setup => sub { 389 # Disable "dieOnError" to test the "protect unconvertable text" behaviour 390 # which can be exercised via the REST handler 391 $extraTML2HTMLOptions{dieOnError} = 0; 392 393 # Override the standard expansion function to hack in an illegal character to force the conversion to fail 394 $extraTML2HTMLOptions{expandVarsInURL} = sub { return "\0"; }; 395 }, 396 tml => '<img src="%PUBURLPATH%">', 397 html => '<div class="WYSIWYG_PROTECTED"><img src="%PUBURLPATH%"></div>' 433 name => 'simpleTable_NoTablePlugin', 434 setup => 435 sub { Foswiki::Func::getContext()->{'TablePluginEnabled'} = 0; }, 436 html => <<'HERE', 437 <p> 438 Before 439 </p> 440 <table border="1" cellpadding="0" cellspacing="1"><tr><th>L</th><th>C</th><th>R</th></tr><tr><td> A2</td><td style="text-align: center" class="align-center"> 2</td><td style="text-align: right" class="align-right"> 2</td></tr><tr><td> A3</td><td style="text-align: center" class="align-center"> 3</td><td style="text-align: left" class="align-left"> 3</td></tr><tr><td> A4-6</td><td> four</td><td> four</td></tr><tr><td>^</td><td> five</td><td> five</td></tr></table><p /><table border="1" cellpadding="0" cellspacing="1"><tr><td>^</td><td> six</td><td> six</td></tr></table> 441 After 442 HERE 443 tml => <<'HERE', 444 Before 445 | *L* | *C* | *R* | 446 | A2 | 2 | 2 | 447 | A3 | 3 | 3 | 448 | A4-6 | four | four | 449 |^| five | five | 450 451 |^| six | six | 452 After 453 454 HERE 455 finaltml => <<'HERE', 456 Before 457 | *L* | *C* | *R* | 458 | A2 | 2 | 2 | 459 | A3 | 3 | 3 | 460 | A4-6 | four | four | 461 | ^ | five | five | 462 463 | ^ | six | six | 464 After 465 HERE 466 }, 467 { 468 exec => $HTML2TML, 469 name => 'ttClassInTable_NoTablePlugin', 470 setup => 471 sub { Foswiki::Func::getContext()->{'TablePluginEnabled'} = 0; }, 472 html => '<table><tr><td class="WYSIWYG_TT">Code</td></tr></table>', 473 tml => '| =Code= |' 474 }, 475 { 476 exec => $TML2HTML | $ROUNDTRIP, 477 name => 'tmlInTable_NoTablePlugin', 478 setup => 479 sub { Foswiki::Func::getContext()->{'TablePluginEnabled'} = 0; }, 480 html => <<'BLAH', 481 <table cellspacing="1" cellpadding="0" border="1"> 482 <tr><td> <span class="WYSIWYG_TT">Code</span> </td></tr> 483 <tr><td> <span class="WYSIWYG_TT">code</span> at start</td></tr> 484 <tr><td>ends with <span class="WYSIWYG_TT">code</span> </td></tr> 485 486 <tr><td> <b><span class="WYSIWYG_TT">Code</span></b> </td></tr> 487 <tr><td> <b><span class="WYSIWYG_TT">code</span></b> at start</td></tr> 488 <tr><td>ends with <b><span class="WYSIWYG_TT">code</span></b> </td></tr> 489 490 <tr><td> <i>Emphasis</i> </td></tr> 491 <tr><td> <i>emphasis</i> at start</td></tr> 492 <tr><td>ends with <i>emphasis</i> </td></tr> 493 494 <tr><td> <b><i>Emphasis</i></b> </td></tr> 495 <tr><td> <b><i>emphasis</i></b> at start</td></tr> 496 <tr><td>ends with <b><i>emphasis</i></b> </td></tr> 497 498 <tr><td> <b>bold</b> at start</td></tr> 499 <tr><td>ends with <b>bold</b> </td></tr> 500 </table> 501 BLAH 502 tml => <<'BLAH', 503 | =Code= | 504 | =code= at start | 505 | ends with =code= | 506 | ==Code== | 507 | ==code== at start | 508 | ends with ==code== | 509 | _Emphasis_ | 510 | _emphasis_ at start | 511 | ends with _emphasis_ | 512 | __Emphasis__ | 513 | __emphasis__ at start | 514 | ends with __emphasis__ | 515 | *bold* at start | 516 | ends with *bold* | 517 BLAH 518 }, 519 { 520 exec => $HTML2TML, 521 name => 'kupuTable_NoTablePlugin', 522 setup => 523 sub { Foswiki::Func::getContext()->{'TablePluginEnabled'} = 0; }, 524 html => 525 '<table cellspacing="0" cellpadding="8" border="1" class="plain" _moz_resizing="true"> 526 <tbody> 527 <tr>a0<td>a1</td><td>a2</td><td>a3</td></tr> 528 <tr>b0<td colspan="2">b1</td><td>b3</td></tr> 529 <tr>c0<td>c1</td><td>c2</td><td>c3</td></tr> 530 </tbody> 531 </table>', 532 tml => '| a1 | a2 | a3 | 533 | b1 || b3 | 534 | c1 | c2 | c3 | 535 ', 536 }, 537 { 538 exec => $TML2HTML | $ROUNDTRIP, 539 name => 'tableWithColSpans_NoTablePlugin', 540 setup => 541 sub { Foswiki::Func::getContext()->{'TablePluginEnabled'} = 0; }, 542 html => '<p>abcd 543 </p> 544 <table cellspacing="1" cellpadding="0" border="1"> 545 <tr><td colspan="2">efg</td><td> </td></tr> 546 <tr><td colspan="3"></td></tr></table> 547 hijk', 548 tml => 'abcd 549 | efg || | 550 |||| 551 hijk', 552 finaltml => 'abcd 553 | efg || | 554 | ||| 555 hijk', 556 }, 557 { 558 exec => $ROUNDTRIP, 559 name => 'Item4410_NoTablePlugin', 560 setup => 561 sub { Foswiki::Func::getContext()->{'TablePluginEnabled'} = 0; }, 562 tml => <<'HERE', 563 * x 564 | Y | 565 HERE 566 html => 567 '<ul><li>x</li></ul><table cellspacing="1" cellpadding="0" border="1"><tr><td>Y</td></tr></table>', 568 }, 569 { 570 exec => $HTML2TML, 571 name => 'tableInnaBun_NoTablePlugin', 572 setup => 573 sub { Foswiki::Func::getContext()->{'TablePluginEnabled'} = 0; }, 574 html => <<'JUNK', 575 <ul> 576 <li> List item</li><li><table><tbody><tr><td> 11</td><td> 21</td></tr><tr><td>12 </td><td> 22</td></tr></tbody></table></li><li>crap</li> 577 </ul> 578 JUNK 579 tml => <<JUNX, 580 * List item 581 * <table><tbody><tr><td> 11</td><td> 21</td></tr><tr><td>12 </td><td> 22</td></tr></tbody></table> 582 * crap 583 JUNX 584 }, 585 { 586 exec => $TML2HTML | $HTML2TML, 587 name => 'Item4700_NoTablePlugin', 588 setup => 589 sub { Foswiki::Func::getContext()->{'TablePluginEnabled'} = 0; }, 590 tml => <<EXPT, 591 | ex | per | iment | 592 | exper | iment || 593 | expe || riment | 594 || exper | iment | 595 EXPT 596 finaltml => <<EXPT, 597 | ex | per | iment | 598 | exper | iment || 599 | expe || riment | 600 | | exper | iment | 601 EXPT 602 html => <<HEXPT, 603 <table cellspacing="1" cellpadding="0" border="1"> 604 <tr><td>ex</td><td>per</td><td>iment</td></tr> 605 <tr><td>exper</td><td colspan="2">iment</td></tr> 606 <tr><td colspan="2">expe</td><td>riment</td></tr> 607 <tr><td></td><td>exper</td><td>iment</td></tr> 608 </table> 609 HEXPT 610 }, 611 { 612 exec => $ROUNDTRIP, 613 name => 'Item4700_2_NoTablePlugin', 614 setup => 615 sub { Foswiki::Func::getContext()->{'TablePluginEnabled'} = 0; }, 616 tml => <<EXPT, 617 | ex | per | iment | 618 | exper | iment || 619 | expe || riment | 620 | | exper | iment | 621 EXPT 622 html => <<HEXPT, 623 <table cellspacing="1" cellpadding="0" border="1"> 624 <tr><td>ex</td><td>per</td><td>iment</td></tr> 625 <tr><td>exper</td><td colspan="2">iment</td></tr> 626 <tr><td colspan="2">expe</td><td>riment</td></tr> 627 <tr><td></td><td>exper</td><td>iment</td></tr> 628 </table> 629 HEXPT 630 }, 631 { 632 name => 'Item4855_NoTablePlugin', 633 setup => 634 sub { Foswiki::Func::getContext()->{'TablePluginEnabled'} = 0; }, 635 exec => $TML2HTML, 636 tml => <<HERE, 637 | [[LegacyTopic1]] | Main.SomeGuy | 638 %TABLESEP% 639 %SEARCH{"legacy" nonoise="on" format="| [[\$topic]] | [[\$wikiname]] |"}% 640 HERE 641 html => <<THERE, 642 <table cellspacing="1" cellpadding="0" border="1"> 643 <tr><td><span class="WYSIWYG_LINK">[[LegacyTopic1]]</span></td><td><span class="WYSIWYG_LINK">Main.SomeGuy</span></td></tr> 644 </table> 645 <span class="WYSIWYG_PROTECTED"><br />%TABLESEP%</span> 646 <span class="WYSIWYG_PROTECTED"><br />%SEARCH{"legacy" nonoise="on" format="| [[\$topic]] | [[\$wikiname]] |"}%</span> 647 THERE 648 }, 649 { 650 name => 'Item1798_NoTablePlugin', 651 setup => 652 sub { Foswiki::Func::getContext()->{'TablePluginEnabled'} = 0; }, 653 exec => $ROUNDTRIP | $TML2HTML, 654 tml => <<HERE, 655 | [[LegacyTopic1]] | Main.SomeGuy | 656 %SEARCH{"legacy" nonoise="on" format="| [[\$topic]] | [[\$wikiname]] |"}% 657 HERE 658 html => <<THERE, 659 <table cellspacing="1" cellpadding="0" border="1"> 660 <tr><td><span class="WYSIWYG_LINK">[[LegacyTopic1]]</span></td><td><span class="WYSIWYG_LINK">Main.SomeGuy</span></td></tr> 661 </table> 662 <span class="WYSIWYG_PROTECTED"><br />%SEARCH{"legacy" nonoise="on" format="| [[\$topic]] | [[\$wikiname]] |"}%</span> 663 THERE 664 }, 665 { 666 exec => $HTML2TML | $ROUNDTRIP, 667 name => 'colorClassInTable_NoTablePlugin', 668 setup => 669 sub { Foswiki::Func::getContext()->{'TablePluginEnabled'} = 0; }, 670 html => <<'BLAH', 671 <table> 672 <tr><th class="WYSIWYG_COLOR" style="color:#FF0000;">Red Heading</th></tr> 673 <tr><td class="WYSIWYG_COLOR" style="color:#FF0000;">Red herring</td></tr> 674 </table> 675 BLAH 676 tml => <<'BLAH', 677 | *%RED%Red Heading%ENDCOLOR%* | 678 | %RED%Red herring%ENDCOLOR% | 679 BLAH 680 }, 681 { 682 exec => $HTML2TML | $ROUNDTRIP, 683 name => 'colorAndTtClassInTable_NoTablePlugin', 684 setup => 685 sub { Foswiki::Func::getContext()->{'TablePluginEnabled'} = 0; }, 686 html => <<'BLAH', 687 <table> 688 <tr><th class="WYSIWYG_COLOR WYSIWYG_TT" style="color:#FF0000;">Redder code</th></tr> 689 <tr><td class="WYSIWYG_COLOR WYSIWYG_TT" style="color:#FF0000;">Red code</td></tr> 690 </table> 691 BLAH 692 tml => <<'BLAH', 693 | *%RED% =Redder code= %ENDCOLOR%* | 694 | %RED% =Red code= %ENDCOLOR% | 695 BLAH 696 }, 697 { 698 name => 'Item4969_NoTablePlugin', 699 setup => 700 sub { Foswiki::Func::getContext()->{'TablePluginEnabled'} = 0; }, 701 exec => $HTML2TML, 702 html => <<HERE, 703 <table cellspacing="1" cellpadding="0" border="1"> 704 <tr><td>table element with a <hr /> horizontal rule</td></tr> 705 </table> 706 Mad Fish 707 HERE 708 tml => '| table element with a <hr /> horizontal rule | 709 Mad Fish', 710 }, 711 { 712 name => 'Item5076_NoTablePlugin', 713 setup => 714 sub { Foswiki::Func::getContext()->{'TablePluginEnabled'} = 0; }, 715 exec => $HTML2TML, 716 html => <<HERE, 717 <table border="0"><tbody><tr><td><h2>Argh</h2><ul><li>Ergh </li></ul></td><td> </td></tr><tr><td> </td><td> </td></tr></tbody></table> 718 HERE 719 tml => '<table border="0"><tbody><tr><td> 720 ---++ Argh 721 * Ergh 722 </td><td> </td></tr><tr><td> </td><td> </td></tr></tbody></table>', 398 723 }, 399 724 ]; … … 409 734 my $fn = 'ExtendedTranslatorTests::testTML2HTML_' . $datum->{name}; 410 735 no strict 'refs'; 411 *$fn = sub { 412 my $this = shift; 413 $this->testSpecificSetup($datum); 414 $this->compareTML_HTML($datum); 736 *$fn = sub { 737 my $this = shift; 738 $this->testSpecificSetup($datum); 739 $this->compareTML_HTML($datum); 415 740 $this->testSpecificCleanup($datum); 416 741 }; … … 420 745 my $fn = 'ExtendedTranslatorTests::testHTML2TML_' . $datum->{name}; 421 746 no strict 'refs'; 422 *$fn = sub { 747 *$fn = sub { 423 748 my $this = shift; 424 $this->testSpecificSetup($datum); 749 $this->testSpecificSetup($datum); 425 750 $this->compareHTML_TML($datum); 426 751 $this->testSpecificCleanup($datum); … … 433 758 *$fn = sub { 434 759 my $this = shift; 435 $this->testSpecificSetup($datum); 760 $this->testSpecificSetup($datum); 436 761 $this->compareRoundTrip($datum); 437 762 $this->testSpecificCleanup($datum); … … 442 767 my $fn = 'TranslatorTests::testCANNOTWYSIWYG_' . $datum->{name}; 443 768 no strict 'refs'; 444 *$fn = sub { 769 *$fn = sub { 445 770 my $this = shift; 446 $this->testSpecificSetup($datum); 771 $this->testSpecificSetup($datum); 447 772 $this->compareNotWysiwygEditable($datum); 448 773 $this->testSpecificCleanup($datum); … … 455 780 sub testSpecificSetup { 456 781 my ( $this, $args ) = @_; 782 457 783 # Reset the extendable parts of WysiwygPlugin 458 784 %Foswiki::Plugins::WysiwygPlugin::xmltag = (); … … 474 800 } 475 801 476 sub TML_HTMLconverterOptions 477 { 478 my $this = shift; 802 sub TML_HTMLconverterOptions { 803 my $this = shift; 479 804 my $options = $this->SUPER::TML_HTMLconverterOptions(@_); 480 for my $extraOptionName ( keys %extraTML2HTMLOptions) {805 for my $extraOptionName ( keys %extraTML2HTMLOptions ) { 481 806 $options->{$extraOptionName} = $extraTML2HTMLOptions{$extraOptionName}; 482 807 }
Note: See TracChangeset
for help on using the changeset viewer.
