From f34f8e59bde8dc60184ebf370ecc4ce3a2afd299 Mon Sep 17 00:00:00 2001 From: Colin Kuskie Date: Tue, 21 Sep 2010 14:02:51 -0700 Subject: [PATCH] Add a test to make sure that view does not return CSS or JS links with src/href attributes. --- t/Asset/Wobject/DataForm/viewForm.t | 59 +++++++++++++++++++++++++++++ 1 file changed, 59 insertions(+) create mode 100644 t/Asset/Wobject/DataForm/viewForm.t diff --git a/t/Asset/Wobject/DataForm/viewForm.t b/t/Asset/Wobject/DataForm/viewForm.t new file mode 100644 index 000000000..81ea69b63 --- /dev/null +++ b/t/Asset/Wobject/DataForm/viewForm.t @@ -0,0 +1,59 @@ +# vim:syntax=perl +#------------------------------------------------------------------- +# WebGUI is Copyright 2001-2009 Plain Black Corporation. +#------------------------------------------------------------------- +# Please read the legal notices (docs/legal.txt) and the license +# (docs/license.txt) that came with this distribution before using +# this software. +#------------------------------------------------------------------ +# http://www.plainblack.com info@plainblack.com +#------------------------------------------------------------------ + +# Test the viewList and related methods of the DataForm +# +# + +use FindBin; +use strict; +use lib "$FindBin::Bin/../../../lib"; +use Test::More; +use Test::Deep; +use WebGUI::Test; # Must use this before any other WebGUI modules +use WebGUI::Session; + +#---------------------------------------------------------------------------- +# Init +my $session = WebGUI::Test->session; + +my $df = WebGUI::Asset->getImportNode($session)->addChild( { + className => 'WebGUI::Asset::Wobject::DataForm', + defaultview => 0, + templateId => 'PBtmpl0000000000000141', +} ); + +# Add fields to the dataform +$df->createField( "bigName", { type => "textarea", isHidden => 0, } ); +$df->createField( "messageCount", { type => "integer", isHidden => 0, } ); + +my $tag = WebGUI::VersionTag->getWorking( $session ); +WebGUI::Test->addToCleanup( $tag ); +$tag->commit; + +$df = $df->cloneFromDb; + +#---------------------------------------------------------------------------- +# Tests + +plan tests => 3; # Increment this number for each test you create + +#---------------------------------------------------------------------------- +# Test getListTemplateVars + +$df->prepareView(); +my $output = $df->view(); + +ok $output, 'got some output'; +ok $output !~ m/+] href/msx, 'no CSS link tags in the output'; +ok $output !~ m/