CSS-Orientation
view release on metacpan or search on metacpan
lib/CSS/Orientation.pm view on Meta::CPAN
$POSSIBLY_NEGATIVE_QUANTITY,
$WHITESPACE,
$WHITESPACE,
$POSSIBLY_NEGATIVE_QUANTITY_SPACE,
$POSSIBLY_NEGATIVE_QUANTITY_SPACE,
$POSSIBLY_NEGATIVE_QUANTITY_SPACE,
$POSSIBLY_NEGATIVE_QUANTITY );
# Compile the cursor resize regexes
our $CURSOR_EAST_RE = resprintf( $LOOKBEHIND_NOT_LETTER . '([ns]?)e-resize' );
our $CURSOR_WEST_RE = resprintf( $LOOKBEHIND_NOT_LETTER . '([ns]?)w-resize' );
# Matches the condition where we need to replace the horizontal component
# of a background-position value when expressed in horizontal percentage.
# Had to make two regexes because in the case of position-x there is only
# one quantity, and otherwise we don't want to match and change cases with only
# one quantity.
our $BG_HORIZONTAL_PERCENTAGE_RE = resprintf( q'background(-position)?(%s:%s)' .
q'([^%%]*?)(%s)%%' .
t/FixCursorProperties.t view on Meta::CPAN
use strict;
use warnings;
use Test::More
tests => 1
;
use CSS::Orientation;
my $input = 'cursor: ne-resize';
my $output = 'cursor: nw-resize';
my $result = CSS::Orientation::FixCursorProperties( $input );
is( $output, $result );
t/cssjanus_test.t view on Meta::CPAN
is( ChangeLeftToRightToLeft( "border-radius: .25em 15px 0pt 0ex" ), "border-radius: 15px .25em 0ex 0pt" );
is( ChangeLeftToRightToLeft( "border-radius: 10px 15px 0px" ), "border-radius: 15px 10px 15px 0px" );
is( ChangeLeftToRightToLeft( "border-radius: 7px 8px" ), "border-radius: 8px 7px" );
is( ChangeLeftToRightToLeft( "border-radius: 5px" ), "border-radius: 5px" );
# testCSSProperty
is( ChangeLeftToRightToLeft( "alright: 10px" ), "alright: 10px" );
is( ChangeLeftToRightToLeft( "alleft: 10px" ), "alleft: 10px" );
# testCursor
is( ChangeLeftToRightToLeft( "cursor: e-resize" ), "cursor: w-resize" );
is( ChangeLeftToRightToLeft( "cursor: w-resize" ), "cursor: e-resize" );
is( ChangeLeftToRightToLeft( "cursor: se-resize" ), "cursor: sw-resize" );
is( ChangeLeftToRightToLeft( "cursor: sw-resize" ), "cursor: se-resize" );
is( ChangeLeftToRightToLeft( "cursor: ne-resize" ), "cursor: nw-resize" );
is( ChangeLeftToRightToLeft( "cursor: nw-resize" ), "cursor: ne-resize" );
# testDirection
is( ChangeLeftToRightToLeft( "direction: ltr" ), "direction: ltr" );
is( ChangeLeftToRightToLeft( "direction: rtl" ), "direction: rtl" );
is( ChangeLeftToRightToLeft( "input { direction: ltr }" ), "input { direction: ltr }" );
is( ChangeLeftToRightToLeft( "body { direction: ltr }" ), "body { direction: rtl }" );
is( ChangeLeftToRightToLeft( "body { padding: 10px; direction: ltr; }" ), "body { padding: 10px; direction: rtl; }" );
is( ChangeLeftToRightToLeft( "body { direction: ltr } .myClass { direction: ltr }" ), "body { direction: rtl } .myClass { direction: ltr }" );
is( ChangeLeftToRightToLeft( "body{\n direction: ltr\n}" ), "body{\n direction: rtl\n}" );
( run in 0.242 second using v1.01-cache-2.11-cpan-4d50c553e7e )