Skip to content

Commit

Permalink
Item9475: perlcritic
Browse files Browse the repository at this point in the history
git-svn-id: http://svn.foswiki.org/trunk@8523 0b4bb1d4-4e5a-0410-9cc4-b2b747904278
  • Loading branch information
PaulHarvey authored and PaulHarvey committed Aug 17, 2010
1 parent 1cf2c58 commit 58c1c28
Showing 1 changed file with 31 additions and 4 deletions.
35 changes: 31 additions & 4 deletions TwistyPlugin/test/unit/TwistyPlugin/TwistyPluginTests.pm
@@ -1,11 +1,10 @@
# See bottom of file for license and copyright information
package TwistyPluginTests;
use strict;
use warnings;

# tests for basic formatting

package TwistyPluginTests;

use FoswikiFnTestCase;
our @ISA = qw( FoswikiFnTestCase );

Expand All @@ -15,7 +14,9 @@ my $TEST_WEB_NAME = 'TemporaryTwistyFormattingTestWeb';
my %mangledIDs;

sub new {
my $self = shift()->SUPER::new( 'TwistyFormatting', @_ );
my ($class, @args) = @_;
my $self = $class->SUPER::new( 'TwistyFormatting', @args );

return $self;
}

Expand All @@ -24,6 +25,8 @@ sub set_up {

%mangledIDs = ();
$this->SUPER::set_up();

return;
}

# This formats the text up to immediately before <nop>s are removed, so we
Expand All @@ -40,6 +43,8 @@ sub do_test {
$actual =~ s/(\d+)(show|hide|toggle)/_mangleID($1).$2/ge;

$this->assert_html_equals( $expected, $actual );

return;
}

# Convert the random IDs into sequential ones, so that we have some hope of
Expand All @@ -66,6 +71,8 @@ SOURCE
my $expected = '<span class="twistyPlugin foswikiMakeVisibleInline"><span id="twistyIdTemporaryTwistyFormattingTestWebTwistyFormattingTestTopicTwistyFormatting1show" class="twistyTrigger foswikiUnvisited twistyHidden twistyInited"><a href="#"><span class="foswikiLinkLabel foswikiUnvisited">More...</span></a></span><span id="twistyIdTemporaryTwistyFormattingTestWebTwistyFormattingTestTopicTwistyFormatting1hide" class="twistyTrigger foswikiUnvisited twistyHidden twistyInited"><a href="#"><span class="foswikiLinkLabel foswikiUnvisited">Close</span></a> </span></span><!--/twistyPlugin foswikiMakeVisibleInline--><span class="twistyPlugin"><span id="twistyIdTemporaryTwistyFormattingTestWebTwistyFormattingTestTopicTwistyFormatting1toggle" class="twistyContent foswikiMakeHidden twistyInited" style="display: none;">content</span></span><!--/twistyPlugin-->';

$this->do_test( $expected, $source );

return;
}

sub test_TWISTY_mode_div {
Expand All @@ -80,6 +87,8 @@ SOURCE
EXPECTED

$this->do_test( $expected, $source );

return;
}

sub test_TWISTY_mode_default_with_id {
Expand All @@ -94,6 +103,8 @@ SOURCE
EXPECTED

$this->do_test( $expected, $source );

return;
}

sub test_TWISTY_2_instances_with_id {
Expand All @@ -110,6 +121,8 @@ SOURCE
EXPECTED

$this->do_test( $expected, $source );

return;
}

sub test_TWISTYSHOW {
Expand All @@ -124,6 +137,8 @@ SOURCE
EXPECTED

$this->do_test( $expected, $source );

return;
}

sub test_TWISTYBUTTON {
Expand All @@ -138,6 +153,8 @@ SOURCE
EXPECTED

$this->do_test( $expected, $source );

return;
}

sub test_TWISTY_with_icons {
Expand Down Expand Up @@ -178,6 +195,8 @@ EXPECTED3
$expected =~ s/src="\n/src="/go;

$this->do_test( $expected, $source );

return;
}

sub test_TWISTY_remember {
Expand Down Expand Up @@ -218,6 +237,8 @@ my twisty content
EXPECTED

$this->do_test( $expected, $source );

return;
}

sub test_TWISTY_escaped_variable {
Expand Down Expand Up @@ -248,6 +269,8 @@ EXPECTED3
$expected =~ s/src="\n/src="/go;

$this->do_test( $expected, $source );

return;
}

sub test_TWISTY_param_linkclass {
Expand All @@ -264,12 +287,14 @@ contents
EXPECTED

$this->do_test( $expected, $source );

return;
}

sub test_twistyInSubWeb {
my $this = shift;
$this->{session}->finish();
$this->{session} = new Foswiki();
$this->{session} = Foswiki->new();

my $testWebSubWebPath = $this->{test_web} . '/SubWeb';
my $webObject = Foswiki::Meta->new( $this->{session}, $testWebSubWebPath );
Expand Down Expand Up @@ -298,6 +323,8 @@ my twisty content
EXPECTED

$this->do_test( $expected, $source, $testWebSubWebPath, $testTopic );

return;
}

1;
Expand Down

0 comments on commit 58c1c28

Please sign in to comment.