Fixes VLAN ID validation for Fixed network

Closes-Bug: #1260640

Change-Id: If7b76e24977c95c7133acd8b9161754264894511
This commit is contained in:
jkirnosova 2013-12-13 13:29:25 +04:00
parent e5c0e954d6
commit 4847e44af8
3 changed files with 9 additions and 9 deletions

View File

@ -296,7 +296,7 @@ function(utils, models, commonViews, dialogViews, networkTabTemplate, networkTem
vlanEnd = (this.network.get('vlan_start') + this.network.get('amount') - 1);
vlanEnd = vlanEnd > 4094 ? 4094 : vlanEnd;
}
this.$('input[name=fixed-vlan_range-end]').val(vlanEnd);
this.$('input[name=fixed-vlan_end]').val(vlanEnd);
}
},
updateFloatingVlanFromPublic: function() {

View File

@ -67,10 +67,10 @@
<div class="networks-sub-title parameter-name"><%= labels.vlan_range %></div>
<div class="range-row">
<div class="parameter-control vlan_start">
<input type="text" class="mini range" name="fixed-vlan_range-start" value="<%- network.get('vlan_start') %>" <%= disabled %> />
<input type="text" class="mini range" name="<%- networkName %>-<%- attribute %>" value="<%- network.get(attribute) %>" <%= disabled %> />
</div>
<div class="parameter-control vlan_end">
<input type="text" class="mini" name="fixed-vlan_range-end" value="<%= network.get('vlan_start') + network.get('amount') - 1 %>" disabled />
<input type="text" class="mini" name="<%- networkName %>-vlan_end" value="<%= network.get(attribute) + network.get('amount') - 1 %>" disabled />
</div>
<div class="error"><span class="help-inline"></span></div>
</div>

View File

@ -80,7 +80,7 @@ casper.then(function() {
return __utils__.getFieldValue('fixed-amount');
});
var initialVlanIDValue = this.evaluate(function(initialValue) {
return __utils__.getFieldValue('fixed-vlan_range-start');
return __utils__.getFieldValue('fixed-vlan_start');
});
var fixtures = [
@ -127,7 +127,7 @@ casper.then(function() {
self.then(function() {
this.fill('.networks-table', {'fixed-amount': fixture.amount});
if (fixture.vlanStart != '') {
this.fill('.networks-table', {'fixed-vlan_range-start': fixture.vlanStart});
this.fill('.networks-table', {'fixed-vlan_start': fixture.vlanStart});
}
this.evaluate(function() {
$('input[name=fixed-amount]').keyup();
@ -136,7 +136,7 @@ casper.then(function() {
this.test.assertExists('input[name=fixed-amount].error', 'Field validation has worked ' + fixture.validationMessage);
this.test.assertExists('.apply-btn:disabled', 'Apply button is disabled if there is validation error');
} else {
this.test.assertEvalEquals(function() {return $('input[name=fixed-vlan_range-end]').val()}, fixture.vlanEnd, 'End value is correct');
this.test.assertEvalEquals(function() {return $('input[name=fixed-vlan_end]').val()}, fixture.vlanEnd, 'End value is correct');
this.test.assertDoesntExist('input[name=fixed-amount].error', 'Field validation works properly with correct value');}
});
});
@ -144,19 +144,19 @@ casper.then(function() {
casper.then(function() {
this.fill('.networks-table', {
'fixed-amount': '1',
'fixed-vlan_range-start': '4094'
'fixed-vlan_start': '4094'
});
this.evaluate(function() {
$('input[name=fixed-amount]').keyup();
});
this.test.assertDoesntExist('input[name=fixed-amount].error', 'Field validation works properly');
this.test.assertDoesntExist('.networks-table.fixed-vlan-end', 'Field end vlan value works properly');
this.test.assertDoesntExist('.networks-table.fixed-vlan_end', 'Field end vlan value works properly');
});
casper.then(function() {
this.fill('.networks-table', {
'fixed-amount': initialAmountValue,
'fixed-vlan_range-start': initialVlanIDValue
'fixed-vlan_start': initialVlanIDValue
});
this.evaluate(function() {
$('input[name=fixed-amount]').keyup();