Changeset 1231 for trunk/t

Show
Ignore:
Timestamp:
10/18/08 19:19:22 (3 months ago)
Author:
dom
Message:

Correctly validate web site URLs during edit and display,
and truncate URLs that are too long (fixes #21)

Location:
trunk/t
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • trunk/t/21_rdf.t

    r1168 r1231  
    5555        locales            => "Bloomsbury\r\nSt Pancras", 
    5656        phone              => "test phone number", 
    57         website            => "test website", 
     57        website            => "http://example.com", 
    5858        hours_text         => "test hours", 
    5959        latitude           => "51.524193", 
     
    7171        locales            => "Bloomsbury\r\nSt Pancras", 
    7272        phone              => "test phone number", 
    73         website            => "test website", 
     73        website            => "http://example.com", 
    7474        hours_text         => "test hours", 
    7575        latitude           => "51.524193", 
     
    9696    "picks up opening hours text" ); 
    9797 
    98 like( $rdfxml, qr|<foaf:homepage rdf:resource="test website" />|, "picks up website" ); 
     98like( $rdfxml, qr|<foaf:homepage rdf:resource="http://example.com" />|, "picks up website" ); 
    9999 
    100100like( $rdfxml, 
  • trunk/t/68_bug_website_displayed.t

    r956 r1231  
    1111} 
    1212 
    13 plan tests => 1; 
     13plan tests => 2; 
    1414 
    1515Wiki::Toolkit::Setup::SQLite::cleardb( { dbname => "t/node.db" } ); 
     
    1818my $guide = OpenGuides->new( config => $config ); 
    1919 
    20 $guide->wiki->write_node( "South Croydon Station", "A sleepy main-line station in what is arguably the nicest part of Croydon.", undef, { website => "http://www.example.com/" } ) or die "Couldn't write node"; 
     20$guide->wiki->write_node( "South Croydon Station", "A sleepy main-line station in what is arguably the nicest part of Croydon.", undef, { website => "http://example.com/" } ) or die "Couldn't write node"; 
     21$guide->wiki->write_node( "North Croydon Station", "A busy main-line station in what is arguably the furthest North part of Croydon.", undef, { website => "http://longer.example.com/asdfasdf" } ) or die "Couldn't write node"; 
    2122 
    2223my $output = $guide->display_node( 
     
    2425                                     return_output => 1, 
    2526                                 ); 
    26 like( $output, qr#Website:</span> <span class="url"><a href="http://www.example.com/">http://www.example.com/</a>#, "website correctly displayed" ); 
     27like( $output, qr#Website:</span> <span class="url"><a href="http://example.com/">http://example.com/</a>#, "website correctly displayed" ); 
    2728 
     29$output = $guide->display_node(    
     30                                    id => "North Croydon Station", 
     31                                    return_output => 1, 
     32                              ); 
     33 
     34like( $output, qr#Website:</span> <span class="url"><a href="http://longer.example.com/asdfasdf">http://longer.exampl...</a>#, "website correctly truncated" );