Skip to content

Commit

Permalink
Item13909: Merge branch 'Item13909'
Browse files Browse the repository at this point in the history
  • Loading branch information
gac410 committed May 2, 2017
2 parents 9276790 + 9dd90e8 commit 796ecf3
Show file tree
Hide file tree
Showing 14 changed files with 353 additions and 207 deletions.
4 changes: 2 additions & 2 deletions PatternSkin/data/System/WebLeftBarPersonalTemplate.txt
Expand Up @@ -4,8 +4,8 @@
Customise this topic; samples and ideas available at %SYSTEMWEB%.WebLeftBarCookbook.
-->
*My links:*
* [[%WIKIUSERNAME%][My home page]]
* [[%SCRIPTURLPATH{search}%/%BASEWEB%/?search=%WIKINAME%;order=modified;limit=50;reverse=on][My %BASEWEB% activities]]
* [[%TMPL:WIKIUSERNAME%][My home page]]
* [[%SCRIPTURLPATH{search}%/%BASEWEB%/?search=%TMPL:WIKINAME%;order=modified;limit=50;reverse=on][My %BASEWEB% activities]]
*
<a class="foswikiSmallish" href="%SCRIPTURLPATH{"edit"}%/%WEB%/%TOPIC%?t=%GM%NOP%TIME{"$epoch"}%">edit</a>

4 changes: 2 additions & 2 deletions TipsContrib/data/System/TipsOfTheDayTemplate.txt
@@ -1,10 +1,10 @@
%META:TOPICINFO{author="ProjectContributor" date="1281633033" format="1.1" version="1"}%
%META:TOPICINFO{author="ProjectContributor" date="1452261257" format="1.1" version="1"}%
%META:TOPICPARENT{name="TipsOfTheDayAdmin"}%
---+ Heading

Quick Summary with link to more information.

[[%SYSTEMWEB%.TipsOfTheDay][See More Tips...]]

-- %WIKIUSERNAME% - %DATE%
-- %TMPL:WIKIUSERNAME% - %TMPL:DATE%

3 changes: 2 additions & 1 deletion UnitTestContrib/lib/Foswiki/Contrib/UnitTestContrib/MANIFEST
Expand Up @@ -105,13 +105,14 @@ test/unit/SecurityTests.pm 0644
test/unit/SeleniumConfigTests.pm 0644
test/unit/SemiAutomaticTestCaseTests.pm 0644
test/unit/SerialiseTests.pm 0644
test/unit/SkinTemplatesTests.pm 0644
test/unit/StoreImplementationTests.pm 0644
test/unit/StoreTests.pm 0644
test/unit/TableParserTests.pm 0644
test/unit/TableReaderTests.pm 0644
test/unit/TableTests.pm 0644
test/unit/TOCTests.pm 0644
test/unit/TemplatesTests.pm 0644
test/unit/TopicTemplatesTests.pm 0644
test/unit/TimeTests.pm 0644
test/unit/UIFnCompileTests.pm 0644
test/unit/UTF8Tests.pm 0644
Expand Down
172 changes: 2 additions & 170 deletions UnitTestContrib/test/unit/SaveScriptTests.pm
Expand Up @@ -420,35 +420,6 @@ qr/AccessControlException: Access to CHANGE TemporarySaveTestWebSave. for duck i
return;
}
sub test_templateTopicTextSave {
my $this = shift;
my $query = Unit::Request->new(
{
text => ['Template Topic'],
action => ['save'],
topic => [ $this->{test_web} . '.TemplateTopic' ]
}
);
$this->createNewFoswikiSession( $this->{test_user_login}, $query );
$this->captureWithKey( save => $UI_FN, $this->{session} );
$query = Unit::Request->new(
{
templatetopic => ['TemplateTopic'],
action => ['save'],
topic => [ $this->{test_web} . '.TemplateTopic' ]
}
);
$this->createNewFoswikiSession( $this->{test_user_login}, $query );
$this->captureWithKey( save => $UI_FN, $this->{session} );
my ($meta) = Foswiki::Func::readTopic( $this->{test_web}, 'TemplateTopic' );
my $text = $meta->text;
$this->assert_matches( qr/Template Topic/, $text );
$this->assert_null( $meta->get('FORM') );
$meta->finish();
return;
}
# Save over existing topic
sub test_prevTopicTextSave {
my $this = shift;
Expand Down Expand Up @@ -565,54 +536,11 @@ sub test_simpleFormSave {
return;
}
sub test_templateTopicFormSave {
my $this = shift;
my $query = Unit::Request->new(
{
text => ['Template Topic'],
formtemplate => ['TestForm1'],
'Select' => ['Value_1'],
'Textfield' => ['Fred'],
action => ['save'],
topic => [ $this->{test_web} . '.TemplateTopic' ]
}
);
$this->createNewFoswikiSession( $this->{test_user_login}, $query );
$this->captureWithKey( save => $UI_FN, $this->{session} );
my ($xmeta) =
Foswiki::Func::readTopic( $this->{test_web}, 'TemplateTopic' );
my $xtext = $xmeta->text;
$xmeta->finish();
$query = Unit::Request->new(
{
templatetopic => ['TemplateTopic'],
action => ['save'],
topic => [ $this->{test_web} . '.TemplateTopicAgain' ]
}
);
$this->createNewFoswikiSession( $this->{test_user_login}, $query );
$this->captureWithKey( save => $UI_FN, $this->{session} );
my ($meta) =
Foswiki::Func::readTopic( $this->{test_web}, 'TemplateTopicAgain' );
my $text = $meta->text;
$this->assert_matches( qr/Template Topic/, $text );
$this->assert_str_equals( 'TestForm1', $meta->get('FORM')->{name} );
$this->assert_str_equals( 'Value_1',
$meta->get( 'FIELD', 'Select' )->{value} );
$this->assert_str_equals( 'Fred',
$meta->get( 'FIELD', 'Textfield' )->{value} );
$meta->finish();
return;
}
sub test_prevTopicFormSave {
my $this = shift;
my $query = Unit::Request->new(
{
text => ['Template Topic'],
text => ['PrevTopic'],
formtemplate => ['TestForm1'],
'Select' => ['Value_1'],
'Textfield' => ['Rubble'],
Expand All @@ -639,7 +567,7 @@ sub test_prevTopicFormSave {
my ($meta) =
Foswiki::Func::readTopic( $this->{test_web}, 'PrevTopicFormSave' );
my $text = $meta->text;
$this->assert_matches( qr/Template Topic/, $text );
$this->assert_matches( qr/PrevTopic/, $text );
$this->assert_str_equals( 'TestForm1', $meta->get('FORM')->{name} );
$this->assert_str_equals( 'Value_1',
$meta->get( 'FIELD', 'Select' )->{value} );
Expand Down Expand Up @@ -831,102 +759,6 @@ sub test_simpleFormSaveEmptyValue {
return;
}
# meta data (other than FORM, FIELD, TOPICPARENT, etc.) is inherited from
# templatetopic
sub test_templateTopicWithMeta {
my $this = shift;
Foswiki::Func::saveTopicText( $this->{test_web}, "TemplateTopic",
$testtext1 );
my $query = Unit::Request->new(
{
templatetopic => ['TemplateTopic'],
action => ['save'],
topic => [ $this->{test_web} . '.TemplateTopicWithMeta' ]
}
);
$this->createNewFoswikiSession( $this->{test_user_login}, $query );
$this->captureWithKey( save => $UI_FN, $this->{session} );
my ($meta) =
Foswiki::Func::readTopic( $this->{test_web}, 'TemplateTopicWithMeta' );
my $text = $meta->text;
my $pref = $meta->get( 'PREFERENCE', 'VIEW_TEMPLATE' );
$this->assert_not_null($pref);
$this->assert_str_equals( 'UserTopic', $pref->{value} );
$meta->finish();
return;
}
# attachments are copied over from templatetopic
sub test_templateTopicWithAttachments {
my $this = shift;
$this->assert(
open( my $FILE, ">", "$Foswiki::cfg{TempfileDir}/testfile.txt" ) );
print $FILE "one two three";
$this->assert( close($FILE) );
$this->assert(
open( $FILE, ">", "$Foswiki::cfg{TempfileDir}/testfile2.txt" ) );
print $FILE "four five six";
$this->assert( close($FILE) );
my $templateTopic = "TemplateTopic";
my $testTopic = "TemplateTopicWithAttachment";
Foswiki::Func::saveTopic( $this->{test_web}, $templateTopic, undef,
"test with an attachment" );
Foswiki::Func::saveAttachment(
$this->{test_web},
$templateTopic,
"testfile.txt",
{
file => "$Foswiki::cfg{TempfileDir}/testfile.txt",
comment => "a comment"
}
);
Foswiki::Func::saveAttachment(
$this->{test_web},
$templateTopic,
"testfile2.txt",
{
file => "$Foswiki::cfg{TempfileDir}/testfile2.txt",
comment => "a comment"
}
);
my $query = Unit::Request->new(
{
templatetopic => ['TemplateTopic'],
action => ['save'],
topic => ["$this->{test_web}.$testTopic"]
}
);
$this->createNewFoswikiSession( $this->{test_user_login}, $query );
$this->captureWithKey( save => $UI_FN, $this->{session} );
my ( $meta, $text ) =
Foswiki::Func::readTopic( $this->{test_web}, $testTopic );
$this->assert_matches( qr/test with an attachment/, $text );
$this->assert_not_null(
$meta->get( 'FILEATTACHMENT', 'testfile.txt' ),
"attachment meta copied for testfile.txt"
);
$this->assert_not_null(
$meta->get( 'FILEATTACHMENT', 'testfile2.txt' ),
"attachment meta copied for testfile2.txt"
);
$this->assert( $meta->testAttachment( "testfile.txt", 'e' ),
"testfile.txt copied" );
$this->assert( $meta->testAttachment( "testfile2.txt", 'e' ),
"testfile2.txt copied" );
$meta->finish();
return;
}
#Mergeing is only enabled if the topic text comes from =text= and =originalrev= is &gt; 0 and is not the same as the revision number of the most recent revision. If mergeing is enabled both the topic and the meta-data are merged.
sub test_merge {
Expand Down
Expand Up @@ -2,7 +2,7 @@
# Unit tests for Foswiki::Templates
#

package TemplatesTests;
package SkinTemplatesTests;
use strict;
use warnings;
use utf8;
Expand Down

0 comments on commit 796ecf3

Please sign in to comment.