Commit effa7a3b authored by Nicolas Wavrant's avatar Nicolas Wavrant

erp5_web_render_js_ui_test: add test for router's display_erp5_action command

parent a0688f9b
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="ZopePageTemplate" module="Products.PageTemplates.ZopePageTemplate"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_bind_names</string> </key>
<value>
<object>
<klass>
<global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/>
</klass>
<tuple/>
<state>
<dictionary>
<item>
<key> <string>_asgns</string> </key>
<value>
<dictionary>
<item>
<key> <string>name_subpath</string> </key>
<value> <string>traverse_subpath</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>content_type</string> </key>
<value> <string>text/html</string> </value>
</item>
<item>
<key> <string>expand</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>testCommandDisplayAction</string> </value>
</item>
<item>
<key> <string>output_encoding</string> </key>
<value> <string>utf-8</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <unicode></unicode> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<html xmlns:tal="http://xml.zope.org/namespaces/tal"
xmlns:metal="http://xml.zope.org/namespaces/metal">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Test Command Display Action</title>
</head>
<body>
<table cellpadding="1" cellspacing="1" border="1">
<thead>
<tr><td rowspan="1" colspan="3">Test Command Display Action</td></tr>
</thead><tbody>
<tal:block metal:use-macro="here/PTZuite_CommonTemplate/macros/init" />
<tr>
<td>open</td>
<td>${base_url}/web_site_module/renderjs_runner/#/?page=router_test</td>
<td></td>
</tr>
<!-- Wait for gadget to be loaded -->
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/wait_for_app_loaded" />
<tr>
<td>assertElementPresent</td>
<td>//div[@class="result-block"]//p[@class="result-0"]</td>
<td></td>
</tr>
<tr>
<td>assertTextPresent</td>
<td>Test 0</td>
<td></td>
</tr>
<!-- Test Link to Module Action -->
<tr>
<td>click</td>
<td>//div[@class="result-block"]//p[@class="result-0"]//a[text()="Link 0"]</td>
<td></td>
</tr>
<!-- Check redirection to dialog happened -->
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/wait_for_dialog_loaded" />
<tr>
<td>assertTextPresent</td>
<td>Do Massively nothing</td>
<td></td>
</tr>
</tbody></table>
</body>
</html>
\ No newline at end of file
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width" />
<title>ERP5 Router test</title>
<!-- renderjs -->
<script src="rsvp.js" type="text/javascript"></script>
<script src="renderjs.js" type="text/javascript"></script>
<script src="handlebars.js" type="text/javascript"></script>
<!-- custom script -->
<script src="gadget_erp5_page_router_test.js" type="text/javascript"></script>
<script id="result-list-template" type="text/x-handlebars-template">
<p class="result-{{i}}">
Test {{i}} : <a href="{{link}}">Link {{i}}</a>
</p>
</script>
</head>
<body>
<h2>Test router commands. Each line is the result of a test</h2>
<div class='result-block'>
<p>
Test 1 : <a href="#">Link 1</a>
</p>
</div>
</body>
</html>
\ No newline at end of file
/*global window, rJS, RSVP, Handlebars */
/*jslint indent: 2, maxerr: 3 */
(function (window, rJS, RSVP, Handlebars) {
"use strict";
var gadget_klass = rJS(window),
template_element = gadget_klass.__template_element,
result_list_template = Handlebars.compile(
template_element
.getElementById("result-list-template")
.innerHTML
);
gadget_klass
.declareAcquiredMethod("getUrlFor", "getUrlFor")
.declareMethod('render', function (options) {
var gadget = this,
result_inner_html = "";
return gadget.getUrlFor({command: 'display_erp5_action', options: {jio_key: "foo_module", page: "empty_mass_action"}})
.push(function (link) {
gadget.element.querySelector(".result-block").innerHTML = result_list_template({
"i": 0,
"link": link
});
});
});
}(window, rJS, RSVP, Handlebars));
\ No newline at end of file
......@@ -45,4 +45,5 @@ portal_tests/renderjs_ui_router_zuite/**
portal_tests/renderjs_ui_translate_zuite
portal_tests/renderjs_ui_translate_zuite/**
portal_tests/renderjs_ui_zuite
portal_tests/renderjs_ui_zuite/**
\ No newline at end of file
portal_tests/renderjs_ui_zuite/**
web_page_module/gadget_erp5_page_router_test_*
\ No newline at end of file
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment