提交 cd604628 编写于 作者: T tfennelly

Cleaned up tests a bit

上级 08a8f147
......@@ -20,10 +20,12 @@ function ConfigRowGrouping(startRow, parentRowGroupContainer) {
this.label = undefined;
}
ConfigRowGrouping.prototype.getRowCount = function() {
ConfigRowGrouping.prototype.getRowCount = function(includeChildren) {
var count = this.rows.length;
for (var i = 0; i < this.rowGroups.length; i++) {
count += this.rowGroups[i].getRowCount();
if (includeChildren === undefined || includeChildren === true) {
for (var i = 0; i < this.rowGroups.length; i++) {
count += this.rowGroups[i].getRowCount();
}
}
return count;
};
......
<form name="config" action="configSubmit" method="post" class="jenkins-config">
<table width="100%" class="job-config tabbed">
<tbody>
<tr>
<td class="setting-name">Project name</td>
<td class="setting-main">
<input name="name" value="Free-2" class="setting-input " type="text"></td>
</tr>
<tr nameref="rowSetStart24">
<td><input type="hidden" name="stapler-class-bag" value="true"></td>
</tr>
<!-- Purposely indenting so as to highlight the implicit data "model" around row groupings -->
<tr style="display:none" class="row-set-start row-group-start" nameref="rowSetStart24"></tr>
<tr class="optional-block-start row-group-start " hashelp="true" ref="cb9" nameref="rowSetStart22">
<td colspan="3">
<input name="specified" class="optional-block-control block-control " type="checkbox">
<label class="attach-previous">Discard Old Builds</label>
</td>
</tr>
<tr class="help-area" nameref="rowSetStart22">
<td></td>
<td colspan="2">
<div class="help">Loading...</div>
</td>
<td></td>
</tr>
<tr class="rowvg-start" nameref="rowSetStart22" style="display: none;"></tr>
<tr nameref="rowSetStart22" style="display: none;"><td class="setting-name">Strategy</td><td class="setting-main"></td></tr>
<tr class="dropdownList-container" nameref="rowSetStart22" style="display: none;"><td colspan="2"></td></tr>
<tr class=" rowvg-end optional-block-end row-group-end" nameref="rowSetStart22"></tr>
<tr class="row-set-end row-group-end" nameref="rowSetStart24"></tr>
<tr>
<td colspan="4">
<div class="section-header"><a id="section0" class="section-anchor">#</a>Advanced Project Options</div>
</td>
</tr>
<tr>
<td>
<script src="/jenkins/adjuncts/5a08e6fd/lib/form/advanced/advanced.js" type="text/javascript"></script>
<div style="" class="advancedLink">
<span class="yui-button yui-push-button advanced-button advancedButton" id="yui-gen9">
<span class="first-child">
<button type="button" tabindex="0" id="yui-gen9-button">Advanced...</button>
</span>
</span>
</div>
<table class="advancedBody">
<tbody>
<tr class="optional-block-start row-group-start " hashelp="true" ref="cb13">
<td colspan="3">
<input class="optional-block-control block-control "type="checkbox"checked="true">
<label class="attach-previous">Quiet period</label>
</td>
</tr>
<tr class="rowvg-start"></tr>
<tr>
<td class="setting-name">Quiet period</td>
<td class="setting-main"></td>
</tr>
<tr>
<td colspan="2"></td>
<td class="setting-description">Number of seconds</td>
</tr>
<tr class=" rowvg-end optional-block-end row-group-end"></tr>
<tr class="optional-block-start row-group-start " hashelp="true" ref="cb14">
<td colspan="3"><input class="optional-block-control block-control "
type="checkbox" id="cb14"><label class="attach-previous">Retry Count</label></td>
</tr>
<tr class="rowvg-start" style="display: none;"></tr>
<tr style="display: none;">
<td class="setting-name">SCM checkout retry count</td>
<td class="setting-main"><input min="0" step="1" value="0"
class="setting-input number" type="number"></td>
</tr>
<tr class=" rowvg-end optional-block-end row-group-end"></tr>
<tr class="optional-block-start row-group-start " hashelp="true" ref="cb15">
<td colspan="3">
<input class="optional-block-control block-control " type="checkbox">
<label class="attach-previous">Block build when upstream project is building</label>
</td>
</tr>
<tr class="rowvg-start" style="display: none;"></tr>
<tr class=" rowvg-end optional-block-end row-group-end"></tr>
<tr class="optional-block-start row-group-start " hashelp="true" ref="cb16">
<td colspan="3"><input class="optional-block-control block-control " type="checkbox">
<label class="attach-previous">Block build when downstream project is building</label>
</td>
</tr>
<tr class="rowvg-start" style="display: none;"></tr>
<tr class=" rowvg-end optional-block-end row-group-end"></tr>
<tr class="optional-block-start row-group-start " hashelp="true" ref="cb17">
<td colspan="3">
<input class="optional-block-control block-control " type="checkbox">
<label class="attach-previous">Use custom workspace</label>
</td>
</tr>
<tr class="rowvg-start" style="display: none;"></tr>
<tr style="display: none;">
<td class="setting-name">Directory</td>
<td class="setting-main"></td>
</tr>
<tr class=" rowvg-end optional-block-end row-group-end"></tr>
<tr>
<td class="setting-name">Display Name</td>
<td class="setting-main"></td>
</tr>
<tr class="optional-block-start row-group-start row-set-start">
<td colspan="3">
<input class="optional-block-control block-control " type="checkbox">
<label class="attach-previous">Keep the build logs of dependencies</label></td>
</tr>
<tr class="rowvg-start" nameref="cb18" style="display: none;"></tr>
<tr class="row-set-end rowvg-end optional-block-end row-group-end"></tr>
</tbody>
</table>
</td>
<td></td>
</tr>
<tr style="display:none" class="row-set-end radio-block-end row-group-end"></tr>
<tr>
<td colspan="4">
<div class="section-header"><a id="section2" class="section-anchor">#</a>Build Triggers</div>
</td>
</tr>
<tr class="optional-block-start row-group-start row-set-start" hashelp="true" ref="cb19">
<td colspan="3">
<input class="optional-block-control block-control "type="checkbox">
<label class="attach-previous">Build after other projects are built</label>
</td>
</tr>
<tr>
<td colspan="4">
<div class="section-header"><a id="section3" class="section-anchor">#</a>Build</div>
</td>
</tr>
<tr>
<td colspan="4">
<div style="height: 74px;"></div>
<div id="bottom-sticker" style="position: fixed; bottom: 83px; left: 378px;">
<div class="bottom-sticker-edge"></div>
<div class="bottom-sticker-inner"><span
class="yui-button yui-submit-button submit-button primary"
id="yui-gen17" name="Submit"><span class="first-child"><button
type="button" tabindex="0" id="yui-gen17-button">Save All
</button></span></span>
<script src="/jenkins/adjuncts/5a08e6fd/lib/form/apply/apply.js"
type="text/javascript"></script>
<input type="hidden" name="core:apply" value=""><span
class="yui-button yui-push-button apply-button applyButton"
id="yui-gen11" name="Apply"><span class="first-child"><button
type="button" tabindex="0" id="yui-gen11-button">Apply All
</button></span></span></div>
</div>
</td>
</tr>
</tbody>
</table>
</form>
\ No newline at end of file
......@@ -10,15 +10,15 @@ describe("tabbar-spec tests", function () {
var jQD = require('jquery-detached');
var $ = jQD.getJQuery();
expect($('.section-header-row', firstTableMetadata.configTable).size()).toBe(6);
expect($('.section-header-row', firstTableMetadata.configTable).size()).toBe(4);
expect(firstTableMetadata.sectionCount()).toBe(4);
expect($('.tabBar .tab').size()).toBe(8);
expect($('.tabBar .tab').size()).toBe(4);
expect(firstTableMetadata.sectionIds().toString())
.toBe('config_general,config__build_triggers,config__advanced_project_options,config__workflow');
.toBe('config_general,config__advanced_project_options,config__build_triggers,config__build');
done();
}, 'widgets/config/workflow-config.html');
}, 'widgets/config/freestyle-config.html');
});
it("- test section activation", function (done) {
......@@ -31,39 +31,45 @@ describe("tabbar-spec tests", function () {
expect(firstTableMetadata.activeSectionCount()).toBe(1);
firstTableMetadata.onShowSection(function() {
expect(this.id).toBe('config__workflow');
expect(this.id).toBe('config__build');
expect(firstTableMetadata.activeSectionCount()).toBe(1);
var activeSection = firstTableMetadata.activeSection();
expect(activeSection.id).toBe('config__workflow');
expect(activeSection.activeRowCount()).toBe(4);
expect(firstTableMetadata.getTopRows().filter('.active').size()).toBe(3); // should be the same as activeSection.activeRowCount()
expect(activeSection.id).toBe('config__build');
expect(activeSection.activeRowCount()).toBe(2);
expect(firstTableMetadata.getTopRows().filter('.active').size()).toBe(1); // should be activeSection.activeRowCount() - 1
done();
});
// Mimic the user clicking on one of the tabs. Should make that section active,
// with all of the rows in that section having an "active" class.
firstTableMetadata.activateSection('config__workflow');
firstTableMetadata.activateSection('config__build');
// above 'firstTableMetadata.onShowSection' handler should get called now
}, 'widgets/config/workflow-config.html');
}, 'widgets/config/freestyle-config.html');
});
it("- test row-set activation", function (done) {
it("- test row-group modeling", function (done) {
jsTest.onPage(function() {
var configTabBar = jsTest.requireSrcModule('widgets/config/tabbar');
var firstTableMetadata = configTabBar.addTabsOnFirst();
var generalSection = firstTableMetadata.activeSection();
expect(generalSection.id).toBe('config_general');
expect(generalSection.rowGroups.length).toBe(3);
expect(generalSection.getRowGroupLabels().toString()).toBe('Discard Old Builds,This build is parameterized,Execute concurrent builds if necessary,Quiet period');
expect(generalSection.rowGroups[0].getRowCount()).toBe(6);
expect(generalSection.rowGroups[1].getRowCount()).toBe(1);
var sectionRowGroups = generalSection.rowGroups;
expect(sectionRowGroups.length).toBe(1);
expect(sectionRowGroups[0].getRowCount(false)).toBe(0); // zero because it does not have any non row-group rows nested immediately inside i.e. does not have any "normal" rows
expect(sectionRowGroups[0].getRowCount(true)).toBe(4); // there are some nested down in the children. see below
expect(sectionRowGroups[0].rowGroups.length).toBe(1);
expect(sectionRowGroups[0].rowGroups[0].getRowCount(false)).toBe(4); // The inner grouping has rows
expect(sectionRowGroups[0].rowGroups[0].getRowCount()).toBe(4); // Same as above ... just making sure they're direct child rows and not nested below
expect(generalSection.getRowGroupLabels().toString()).toBe('Discard Old Builds');
done();
}, 'widgets/config/workflow-config.html');
}, 'widgets/config/freestyle-config.html');
});
});
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册