public void test_render_accumulatedJs() {
   cr.getMainDataset().set("device", "IPhone");
   PhoneToolbarSection toolbar = new PhoneToolbarSection(new Dataset("buttons", data4));
   cr.showSections(toolbar);
   TestUtil.assertSubstring(
       "Accumulated Js", "new Fiz.IPhonePhoneToolbarSection(\"footer\")", cr.getHtml().getJs());
 }
 public void test_render_includeJs() {
   cr.getMainDataset().set("device", "IPhone");
   PhoneToolbarSection toolbar = new PhoneToolbarSection(new Dataset("buttons", data4));
   cr.showSections(toolbar);
   TestUtil.assertSubstring(
       "JS files requested", "IPhonePhoneToolbarSection.js", cr.getHtml().getJsFiles());
 }
 public void test_render_dontIncludeCss() {
   cr.getMainDataset().set("device", "IPhone");
   PhoneToolbarSection toolbar =
       new PhoneToolbarSection(new Dataset("buttons", data4, "class", "special"));
   cr.showSections(toolbar);
   TestUtil.assertSubstring("CSS files requested", "", cr.getHtml().getCssFiles());
 }
Esempio n. 4
0
 public String getPageIds(ClientRequest cr) {
   HttpSession session = cr.getServletRequest().getSession();
   PageState.AllPageInfo info = (PageState.AllPageInfo) session.getAttribute("fiz.PageState");
   if (info == null) {
     return "";
   }
   Object[] keys = info.keySet().toArray();
   Arrays.sort(keys);
   return StringUtil.join(keys, ", ");
 }
 public void test_render_basics() {
   cr.getMainDataset().set("device", "IPhone");
   PhoneToolbarSection toolbar = new PhoneToolbarSection(new Dataset("buttons", data4));
   cr.showSections(toolbar);
   assertEquals(
       "generated HTML",
       "\n<!-- Start PhoneToolbarSection -->\n"
           + "<div id=\"footer\" class=\"toolbarSection\">\n"
           + "   <table><tr>\n"
           + "  <td id=\"tdBookmarksBM\"><a href=\"#\" "
           + "onclick=\"void new Fiz.Ajax({url: &quot;newMethod1&quot;});"
           + " return false;\">"
           + "<div class=\"toolbarButton\" "
           + "id=\"BM-toolbarButton-Bookmarks\">"
           + "<div><img id=\"BookmarksBM\" alt=\"BM\" "
           + "src=\"/static/fiz/images/Bookmarks.png\"/>"
           + "</div><span>BM</span></div></a></td>\n"
           + "  <td id=\"tdFavoriteLike\"><a href=\"http://www.google.com/\">"
           + "<div class=\"toolbarButton\" "
           + "id=\"Like-toolbarButton-Favorite\">"
           + "<div><img id=\"FavoriteLike\" alt=\"Like\" "
           + "src=\"/static/fiz/images/Favorite.png\"/>"
           + "</div><span>Like</span></div></a></td>\n"
           + "  <td id=\"tdChatChat\"><a href=\"#\" "
           + "onclick=\"alert(&quot;Hello World&quot;); return false;\">"
           + "<div class=\"toolbarButton\" "
           + "id=\"Chat-toolbarButton-Chat\">"
           + "<div><img id=\"ChatChat\" alt=\"Chat\" "
           + "src=\"/static/fiz/images/Chat.png\"/>"
           + "</div><span>Chat</span></div></a></td>\n"
           + "  <td id=\"tdPlusAdd\"><a href=\"newMethod4\">"
           + "<div class=\"toolbarButton\" "
           + "id=\"Add-toolbarButton-Plus\">"
           + "<div><img id=\"PlusAdd\" alt=\"Add\" "
           + "src=\"/static/fiz/images/Plus.png\"/>"
           + "</div><span>Add</span></div></a></td>\n"
           + "   </tr></table>\n"
           + "</div>\n"
           + "<!-- End PhoneToolbarSection -->\n",
       cr.getHtml().getBody().toString());
   TestUtil.assertXHTML(cr.getHtml().toString());
 }