[Rt-commit] r6450 - in rt/branches/3.6-RELEASE: html/Search
ruz at bestpractical.com
ruz at bestpractical.com
Thu Nov 16 17:07:58 EST 2006
Author: ruz
Date: Thu Nov 16 17:07:58 2006
New Revision: 6450
Modified:
rt/branches/3.6-RELEASE/html/Search/Build.html
rt/branches/3.6-RELEASE/lib/t/regression/21query-builder.t
Log:
* fix TODO tests in query builder and add new tests
** all tests are related to building queries like 'C1 OR ( C2 AND C3 )',
QB was changing all entry aggregators to AND
Modified: rt/branches/3.6-RELEASE/html/Search/Build.html
==============================================================================
--- rt/branches/3.6-RELEASE/html/Search/Build.html (original)
+++ rt/branches/3.6-RELEASE/html/Search/Build.html Thu Nov 16 17:07:58 2006
@@ -271,7 +271,6 @@
# make a tree root
$$tree = RT::Interface::Web::QueryBuilder::Tree->new;
my $root = RT::Interface::Web::QueryBuilder::Tree->new( 'AND', $$tree );
- my $lastnode = $root;
my $parentnode = $root;
# get the FIELDS from Tickets_Overlay
@@ -345,13 +344,13 @@
else {
$depth--;
$parentnode = $parentnode->getParent();
- $lastnode = $parentnode;
}
$want = KEYWORD | PAREN | AGGREG;
}
elsif ( $current & AGGREG ) {
$ea = $val;
+ $parentnode->setNodeValue($ea);
$want = KEYWORD | PAREN;
}
elsif ( $current & KEYWORD ) {
@@ -416,8 +415,7 @@
};
# explicity add a child to it
- $lastnode = RT::Interface::Web::QueryBuilder::Tree->new( $clause, $parentnode );
- $lastnode->getParent()->setNodeValue($ea);
+ RT::Interface::Web::QueryBuilder::Tree->new( $clause, $parentnode );
( $ea, $key, $op, $value ) = ( "", "", "", "" );
Modified: rt/branches/3.6-RELEASE/lib/t/regression/21query-builder.t
==============================================================================
--- rt/branches/3.6-RELEASE/lib/t/regression/21query-builder.t (original)
+++ rt/branches/3.6-RELEASE/lib/t/regression/21query-builder.t Thu Nov 16 17:07:58 2006
@@ -1,7 +1,7 @@
#!/usr/bin/perl
use strict;
-use Test::More tests => 31;
+use Test::More tests => 35;
use Test::WWW::Mechanize;
use HTTP::Request::Common;
use HTTP::Cookies;
@@ -78,6 +78,7 @@
ok($agent->form_name('BuildQuery'), "found the form a third time");
sub getQueryFromForm {
+ $agent->form_name('BuildQuery');
# This pulls out the "hidden input" query from the page
my $q = $agent->current_form->find_input("Query")->value;
$q =~ s/^\s+//g;
@@ -139,37 +140,36 @@
$agent->click("Up");
ok($agent->form_name('BuildQuery'), "found the form again");
-TODO: {
- local $TODO = "query builder incorrectly changes OR to AND";
- is(getQueryFromForm, "( id > 1234 ) OR Queue != 'Regression'", "moved up");
-}
+is(getQueryFromForm, "( id > 1234 ) OR Queue != 'Regression'", "moved up");
$agent->select("clauses", ["0"]); # this is a null clause
-
$agent->click("Up");
-
ok($agent->form_name('BuildQuery'), "found the form again");
-
$agent->content_like(qr/error: can\S+t move up/, "i shouldn't have been able to hit up");
$agent->click("Left");
-
ok($agent->form_name('BuildQuery'), "found the form again");
-
$agent->content_like(qr/error: can\S+t move left/, "i shouldn't have been able to hit left");
$agent->select("clauses", ["1"]);
$agent->select("ValueOfStatus" => "stalled");
-
$agent->submit;
ok($agent->form_name('BuildQuery'), "found the form again");
is_deeply(selectedClauses, ["2"], 'the one we added is selected');
-TODO: {
- local $TODO = "query builder incorrectly changes OR to AND";
- is(getQueryFromForm, "( id > 1234 AND Status = 'stalled' ) OR Queue != 'Regression'", "added new one");
-}
-
+is( getQueryFromForm, "( id > 1234 AND Status = 'stalled' ) OR Queue != 'Regression'", "added new one" );
+# click advanced, enter "C1 OR ( C2 AND C3 )", apply, aggregators should stay the same.
+{
+ my $response = $agent->get($url."Search/Edit.html");
+ ok( $response->is_success, "Fetched /Search/Edit.html" );
+ ok($agent->form_number(3), "found the form");
+ $agent->field("Query", "Status = 'new' OR ( Status = 'open' AND Subject LIKE 'office' )");
+ $agent->submit;
+ is( getQueryFromForm,
+ "Status = 'new' OR ( Status = 'open' AND Subject LIKE 'office' )",
+ "no aggregators change"
+ );
+}
# - new items go one level down
# - add items at currently selected level
@@ -213,5 +213,4 @@
# }}}
-
1;
More information about the Rt-commit
mailing list