aboutsummaryrefslogtreecommitdiff
path: root/engine/tests/ui/submenu.php
diff options
context:
space:
mode:
authorbrettp <brettp@36083f99-b078-4883-b0ff-0f9b5a30f544>2010-05-08 03:42:23 +0000
committerbrettp <brettp@36083f99-b078-4883-b0ff-0f9b5a30f544>2010-05-08 03:42:23 +0000
commitaa011b14603ba807121c811399685895a9c75d67 (patch)
tree26a2916749929b34f5295fa55ee4c7d62126e17d /engine/tests/ui/submenu.php
parent7682706a46a20e3e58a9afd8ba208d5b0c040499 (diff)
downloadelgg-aa011b14603ba807121c811399685895a9c75d67.tar.gz
elgg-aa011b14603ba807121c811399685895a9c75d67.tar.bz2
Added new submenu system.
Added elgg_http_url_is_identical(). Moved canvas_header/submenu* to navigation/submenu*. Added UI test for submenu. git-svn-id: http://code.elgg.org/elgg/trunk@5982 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'engine/tests/ui/submenu.php')
-rw-r--r--engine/tests/ui/submenu.php97
1 files changed, 97 insertions, 0 deletions
diff --git a/engine/tests/ui/submenu.php b/engine/tests/ui/submenu.php
new file mode 100644
index 000000000..d7a156417
--- /dev/null
+++ b/engine/tests/ui/submenu.php
@@ -0,0 +1,97 @@
+<?php
+/**
+ * 1.8 submenu test.
+ *
+ * Submenu needs to be able to support being added out of order.
+ * Children can be added before parents.
+ * Children of parents never defined are never shown.
+ *
+ * Test against:
+ * different contexts
+ * different groups
+ * old add_submenu_item() wrapper.
+ *
+ */
+
+require_once('../../start.php');
+
+$url = "{$CONFIG->url}engine/tests/ui/submenu.php";
+
+$items = array(
+ array(
+ 'text' => 'Upper level 1',
+ 'url' => "$url?upper_level_1",
+ 'id' => 'ul1'
+ ),
+ array(
+ 'text' => 'CD (No link)',
+ 'parent_id' => 'cup',
+ 'id' => 'cd',
+ ),
+ array(
+ 'text' => 'Sub CD',
+ 'url' => "$url?sub_cd",
+ 'parent_id' => 'cd'
+ ),
+ array(
+ 'text' => 'Cup',
+ 'url' => "$url?cup",
+ 'id' => 'cup'
+ ),
+ array(
+ 'text' => 'Phone',
+ 'url' => "$url?phone",
+ 'id' => 'phone',
+ 'parent_id' => 'cup'
+ ),
+ array(
+ 'text' => 'Wallet',
+ 'url' => "$url?wallet",
+ 'id' => 'wallet',
+ 'parent_id' => 'phone'
+ ),
+ array(
+ 'text' => 'Upper level',
+ 'url' => "$url?upper_level",
+ 'id' => 'ul'
+ ),
+ array(
+ 'text' => 'Sub Upper level',
+ 'url' => "$url?sub_upper_level",
+ 'parent_id' => 'ul'
+ ),
+ array(
+ 'text' => 'Root',
+ 'url' => $url,
+ ),
+
+ array(
+ 'text' => 'I am an orphan',
+ 'url' => 'http://google.com',
+ 'parent_id' => 'missing_parent'
+ ),
+
+ array(
+ 'text' => 'JS Test',
+ 'url' => 'http://elgg.org',
+ 'vars' => array('js' => 'onclick="alert(\'Link to \' + $(this).attr(\'href\') + \'!\'); return false;"')
+ )
+);
+
+foreach ($items as $item) {
+ elgg_add_submenu_item($item, 'main');
+}
+
+add_submenu_item('Old Onclick Test', 'http://elgg.com', NULL, TRUE);
+add_submenu_item('Old Selected Test', 'http://elgg.com', NULL, '', TRUE);
+
+
+elgg_add_submenu_item(array('text' => 'Not Main Test', 'url' => "$url?not_main_test"), 'not_main', 'new_menu');
+elgg_add_submenu_item(array('text' => 'Not Main C Test', 'url' => "$url?not_main_c_test"), 'not_main', 'new_menu');
+
+elgg_add_submenu_item(array('text' => 'All test', 'url' => "$url?all"), 'all');
+
+//set_context('not_main');
+
+$body = elgg_view_layout('one_column_with_sidebar', 'Look right.');
+page_draw('Submenu Test', $body);