mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-12-28 11:28:38 +00:00
- allow testcase display template to be re-used in a single testcase display context
- in management interface, display testcase as it will appear to the user by default until the admin enters editing mode
This commit is contained in:
parent
afbc7f20c9
commit
f737740207
@ -57,6 +57,8 @@ function loadTestcase() {
|
||||
if (! testcase_select ||
|
||||
testcase_select.options[testcase_select.selectedIndex].value=="") {
|
||||
disableModeButtons();
|
||||
document.getElementById('testcase_display_div').style.display = 'none';
|
||||
document.getElementById('editform_div').style.display = 'none';
|
||||
disableForm('edit_testcase_form');
|
||||
blankForm('edit_testcase_form');
|
||||
return false;
|
||||
@ -90,12 +92,18 @@ function populateTestcase(data) {
|
||||
document.getElementById('editform_summary').value = testcase.summary;
|
||||
document.getElementById('editform_steps').value = testcase.steps;
|
||||
document.getElementById('editform_results').value = testcase.expected_results;
|
||||
document.getElementById('testcase_id_display').innerHTML = testcase.testcase_id;
|
||||
document.getElementById('summary_text').innerHTML = testcase.summary;
|
||||
document.getElementById('steps_text').innerHTML = testcase.steps;
|
||||
document.getElementById('results_text').innerHTML = testcase.expected_results;
|
||||
|
||||
var product_box = document.getElementById('product');
|
||||
var options = product_box.getElementsByTagName('option');
|
||||
var found_product = 0;
|
||||
for (var i=0; i<options.length; i++) {
|
||||
if (options[i].value == testcase.product_id.product_id) {
|
||||
options[i].selected = true;
|
||||
document.getElementById('product_text').innerHTML = options[i].text;
|
||||
found_product=1;
|
||||
} else {
|
||||
options[i].selected = false;
|
||||
@ -121,6 +129,20 @@ function populateTestcase(data) {
|
||||
if (found_testgroup == 0) {
|
||||
options[0].selected = true;
|
||||
}
|
||||
|
||||
var testgroups_text = "";
|
||||
for (var i in testcase.testgroups) {
|
||||
if (testcase.testgroups[i].name != '') {
|
||||
testgroups_text = testgroups_text + testcase.testgroups[i].name + ', ';
|
||||
}
|
||||
}
|
||||
if (testgroups_text != '') {
|
||||
testgroups_text = testgroups_text.replace(/, $/g,'');
|
||||
document.getElementById('testgroups_display').innerHTML = testgroups_text;
|
||||
} else {
|
||||
document.getElementById('testgroups_display').innerHTML = '<span class="errorHeading">This testcase does not belong to any testgroups that are currently enabled.</span>';
|
||||
}
|
||||
|
||||
changeTestgroup();
|
||||
var found_subgroup = 0;
|
||||
if (testcase.subgroups[0]) {
|
||||
@ -138,6 +160,20 @@ function populateTestcase(data) {
|
||||
if (found_subgroup == 0) {
|
||||
options[0].selected = true;
|
||||
}
|
||||
|
||||
var subgroups_text = "";
|
||||
for (var i in testcase.subgroups) {
|
||||
if (testcase.subgroups[i].name != '') {
|
||||
subgroups_text = subgroups_text + testcase.subgroups[i].name + ', ';
|
||||
}
|
||||
}
|
||||
if (subgroups_text != '') {
|
||||
subgroups_text = subgroups_text.replace(/, $/g,'');
|
||||
document.getElementById('subgroups_display').innerHTML = subgroups_text;
|
||||
} else {
|
||||
document.getElementById('subgroups_display').innerHTML = '<span class="errorHeading">This testcase does not belong to any subgroups that are currently enabled.</span>';
|
||||
}
|
||||
|
||||
var enabled_em = document.getElementById('editform_enabled')
|
||||
if (testcase.enabled == 1) {
|
||||
enabled_em.checked = true;
|
||||
@ -160,6 +196,8 @@ function populateTestcase(data) {
|
||||
document.getElementById('editform_testrunner_case_id').innerHTML = testcase.testrunner_case_id;
|
||||
document.getElementById('editform_testrunner_case_version').innerHTML = testcase.testrunner_case_version;
|
||||
|
||||
document.getElementById('editform_div').style.display = 'none';
|
||||
document.getElementById('testcase_display_div').style.display = 'block';
|
||||
enableModeButtons();
|
||||
}
|
||||
|
||||
@ -201,12 +239,16 @@ function switchToAdd() {
|
||||
document.getElementById('editform_submit').value = 'Add Testcase';
|
||||
document.getElementById('editform_mode').value = 'add';
|
||||
enableForm('edit_testcase_form');
|
||||
document.getElementById('testcase_display_div').style.display = 'none';
|
||||
document.getElementById('editform_div').style.display = 'block';
|
||||
}
|
||||
|
||||
function switchToEdit() {
|
||||
document.getElementById('editform_submit').value = 'Submit Edits';
|
||||
document.getElementById('editform_mode').value = 'edit';
|
||||
enableForm('edit_testcase_form');
|
||||
document.getElementById('testcase_display_div').style.display = 'none';
|
||||
document.getElementById('editform_div').style.display = 'block';
|
||||
}
|
||||
|
||||
</script>
|
||||
@ -235,8 +277,8 @@ function switchToEdit() {
|
||||
<td>
|
||||
<input id="add_testcase_button" name="add_testcase_button" class="manage" type="button" onClick="switchToAdd();" value="Add new testcase">
|
||||
<input id="edit_testcase_button" name="edit_testcase_button" class="manage" type="button" onClick="switchToEdit();" value="Edit testcase" disabled>
|
||||
<input id="clone_testcase_button" name="clone_testcase_button" class="manage" type="submit" onClick="confirm('Really clone this testcase?');" value="Clone testcase" disabled>
|
||||
<input id="delete_testcase_button" name="delete_testcase_button" class="manage" type="submit" onClick="confirm('Really delete this testcase?');" value="Delete testcase" disabled>
|
||||
<input id="clone_testcase_button" name="clone_testcase_button" class="manage" type="submit" onClick="return confirm('Really clone this testcase?');" value="Clone testcase" disabled>
|
||||
<input id="delete_testcase_button" name="delete_testcase_button" class="manage" type="submit" onClick="return confirm('Really delete this testcase?');" value="Delete testcase" disabled>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
@ -245,8 +287,17 @@ function switchToEdit() {
|
||||
</div> <!--end section-content-->
|
||||
</div> <!--end section-full-->
|
||||
|
||||
<div class="section-full">
|
||||
<div id="testcase-title" class="section-header">Testcase info</div>
|
||||
<div style="display: none;" id="testcase_display_div" class="section-full"> <div id="testcase-title" class="section-header">Testcase Info</div>
|
||||
<div class="section-content">
|
||||
|
||||
<div class="testcase-content">
|
||||
[% INCLUDE test/test.html.tmpl testcase=testcase show_config=1 show_edit=1 %]
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div style="display: none;" id="editform_div" class="section-full">
|
||||
<div id="testcase-title" class="section-header">Testcase Info</div>
|
||||
|
||||
<div class="section-content">
|
||||
|
||||
|
@ -29,6 +29,7 @@
|
||||
# $testcase - the testcase object to show
|
||||
# $show_config - display the config options (testgroup, subgroup, etc.)
|
||||
# for a given testcase
|
||||
# $show_edit (optional) - display testcase for editing
|
||||
#%]
|
||||
|
||||
[% PROCESS global/selects.none.tmpl %]
|
||||
@ -38,30 +39,29 @@
|
||||
<tr>
|
||||
<td width="20%"><b>Product:</b></td>
|
||||
<td>
|
||||
<div id="product_text_[% testcase.testcase_id | html %]">[% testcase.product.name | html %]</div>
|
||||
</td>
|
||||
<td align="right" valign="top" colspan="5"><a href="manage_testcases.cgi?testcase_id=[%testcase.testcase_id | html%]"> Edit Testcase</a>
|
||||
<div id="product_text[% IF ! show_edit %]_[% testcase.testcase_id | html %][% END %]">[% testcase.product.name | html %]</div>
|
||||
</td>
|
||||
[% IF ! show_edit %]<td align="right" valign="top" colspan="5"><a href="manage_testcases.cgi?testcase_id=[%testcase.testcase_id | html%]"> Edit Testcase</a></td>[% END %]
|
||||
</tr>
|
||||
<tr>
|
||||
<td><b>Test Group(s):</b></td>
|
||||
<td>
|
||||
<div id="testgroups_[% testcase.testcase_id | html %]">[% IF testgroups.size==0 %]<span class="errorHeading">This testcase does not belong to any testgroups that are currently enabled.</span>[% ELSE %][% FOREACH testgroup=testgroups %][% testgroup.name | html %][% UNLESS loop.last %], [% END %][% END %][% END %]</div>
|
||||
<div id="testgroups_display[% IF ! show_edit %]_[% testcase.testcase_id | html %][% END %]">[% IF testgroups.size==0 %]<span class="errorHeading">This testcase does not belong to any testgroups that are currently enabled.</span>[% ELSE %][% FOREACH testgroup=testgroups %][% testgroup.name | html %][% UNLESS loop.last %], [% END %][% END %][% END %]</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><b>Subgroup(s):</b></td>
|
||||
<td>
|
||||
<div id="subgroups_[% testcase.testcase_id | html %]">[% IF subgroups.size==0 %]<span class="errorHeading">This testcase does not belong to any subgroups that are currently enabled.</span>[% ELSE %][% FOREACH subgroup=subgroups %][% subgroup.name | html %][% UNLESS loop.last %], [% END %][% END %][% END %]</div>
|
||||
<div id="subgroups_display[% IF ! show_edit %]_[% testcase.testcase_id | html %][% END %]">[% IF subgroups.size==0 %]<span class="errorHeading">This testcase does not belong to any subgroups that are currently enabled.</span>[% ELSE %][% FOREACH subgroup=subgroups %][% subgroup.name | html %][% UNLESS loop.last %], [% END %][% END %][% END %]</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><b>Testcase ID #:</b></td>
|
||||
<td>[% testcase.testcase_id | html %]</td>
|
||||
<td id="testcase_id_display[% IF ! show_edit %]_[% testcase.testcase_id | html %][% END %]">[% testcase.testcase_id | html %]</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><b>Summary:</b></td>
|
||||
<td><div id="summary_text_[%testcase.testcase_id | html%]">[% testcase.summary | html %]</div></td>
|
||||
<td><div id="summary_text[% IF ! show_edit %]_[%testcase.testcase_id | html%][% END %]">[% testcase.summary | html %]</div></td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
@ -71,16 +71,16 @@
|
||||
<table cellspacing="0" cellpadding="0" class="tcm">
|
||||
<tr>
|
||||
<td width="50%" class="content"><div class="dh">Steps to Perform:</div>
|
||||
<div class="dv" id="steps_text_[%testcase.testcase_id | html%]">[% testcase.steps | markdown | testdata %]</div>
|
||||
<div class="dv" id="steps_text[% IF ! show_edit %]_[%testcase.testcase_id | html%][% END %]">[% testcase.steps | markdown | testdata %]</div>
|
||||
</td>
|
||||
<td width="50%" class="content"><div class="dh">Expected Results:</div>
|
||||
<div class="dv" id="results_text_[%testcase.testcase_id | html%]">[% testcase.expected_results | markdown | testdata %]</div>
|
||||
<div class="dv" id="results_text[% IF ! show_edit %]_[%testcase.testcase_id | html%][% END %]">[% testcase.expected_results | markdown | testdata %]</div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
[% IF defaultemail OR sysconfig %]
|
||||
[% IF defaultemail AND ! show_edit %]
|
||||
<!-- Only allow the user to submit a single result if they are already
|
||||
logged in _AND_ have a sysconfig cookie for the current product. -->
|
||||
logged in. -->
|
||||
<tr>
|
||||
<td class="content" colspan="2">
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user