fix tabs in portsort.html

This commit is contained in:
Oliver Gorwits
2014-10-09 16:54:47 +01:00
parent 93b19240e2
commit 6564d9ca29

View File

@@ -1,188 +1,188 @@
<!DOCTYPE html> <!DOCTYPE html>
<html> <html>
<head> <head>
<meta charset="utf-8"> <meta charset="utf-8">
<title>portsort.js test suite</title> <title>portsort.js test suite</title>
<script src="http://code.jquery.com/jquery-1.11.1.min.js" type="text/javascript"></script> <script src="http://code.jquery.com/jquery-1.11.1.min.js" type="text/javascript"></script>
<script src="http://code.jquery.com/qunit/qunit-1.14.0.js" type="text/javascript"></script> <script src="http://code.jquery.com/qunit/qunit-1.14.0.js" type="text/javascript"></script>
<script src="../js/qunit-tap.js" type="text/javascript"></script> <script src="../js/qunit-tap.js" type="text/javascript"></script>
<script> <script>
qunitTap(QUnit, function() { console.log.apply(console, arguments); }); qunitTap(QUnit, function() { console.log.apply(console, arguments); });
</script> </script>
<link href="http://code.jquery.com/qunit/qunit-1.14.0.css" type="text/css" rel="stylesheet"></link> <link href="http://code.jquery.com/qunit/qunit-1.14.0.css" type="text/css" rel="stylesheet"></link>
<script src="../../share/public/javascripts/jquery.dataTables.min.js" type="text/javascript"></script> <script src="../../share/public/javascripts/jquery.dataTables.min.js" type="text/javascript"></script>
<script src="../../share/public/javascripts/portsort.js" type="text/javascript"></script> <script src="../../share/public/javascripts/portsort.js" type="text/javascript"></script>
<script type="text/javascript"> <script type="text/javascript">
$(function () { $(function () {
module("portsort.js"), module("portsort.js"),
test("different values types", function () { test("different values types", function () {
wrapTest( wrapTest(
['a',1], ['a',1],
[1,'a'], [1,'a'],
'number always comes first'); 'number always comes first');
wrapTest( wrapTest(
['1',1], ['1',1],
['1',1], ['1',1],
'number vs numeric string - should remain unchanged (error in chrome)'); 'number vs numeric string - should remain unchanged (error in chrome)');
wrapTest( wrapTest(
['02',3,2,'01'], ['02',3,2,'01'],
['01','02',2,3], ['01','02',2,3],
'padding numeric string vs number'); 'padding numeric string vs number');
}); });
test("numerics", function () { test("numerics", function () {
wrapTest( wrapTest(
['10',9,2,'1','4'], ['10',9,2,'1','4'],
['1',2,'4',9,'10'], ['1',2,'4',9,'10'],
'string vs number'); 'string vs number');
wrapTest( wrapTest(
['0001','002','001'], ['0001','002','001'],
['0001','001','002'], ['0001','001','002'],
'0 left-padded numbers'); '0 left-padded numbers');
wrapTest( wrapTest(
[2,1,'1','0001','002','02','001'], [2,1,'1','0001','002','02','001'],
['0001','001','002','02',1,'1',2], ['0001','001','002','02',1,'1',2],
'0 left-padded numbers and regular numbers'); '0 left-padded numbers and regular numbers');
wrapTest( wrapTest(
['10.0401',10.022,10.042,'10.021999'], ['10.0401',10.022,10.042,'10.021999'],
['10.021999',10.022,'10.0401',10.042], ['10.021999',10.022,'10.0401',10.042],
'decimal string vs decimal, different precision'); 'decimal string vs decimal, different precision');
wrapTest( wrapTest(
['10.04',10.02,10.03,'10.01'], ['10.04',10.02,10.03,'10.01'],
['10.01',10.02,10.03,'10.04'], ['10.01',10.02,10.03,'10.04'],
'decimal string vs decimal, same precision'); 'decimal string vs decimal, same precision');
wrapTest( wrapTest(
['10001','10011','101','10010','10','100','10002', ['10001','10011','101','10010','10','100','10002',
'10112','10111'], '10112','10111'],
['10','100','101','10001','10002','10010','10011', ['10','100','101','10001','10002','10010','10011',
'10111','10112'], '10111','10112'],
'mixed length'); 'mixed length');
}); });
test("IP addresses", function () { test("IP addresses", function () {
wrapTest( wrapTest(
[ [
'192.168.0.100', '192.168.0.100',
'192.168.0.1', '192.168.0.1',
'192.168.1.1', '192.168.1.1',
'192.168.0.250', '192.168.0.250',
'192.168.1.123', '192.168.1.123',
'10.0.0.2', '10.0.0.2',
'10.0.0.1' '10.0.0.1'
], ],
[ [
'10.0.0.1', '10.0.0.1',
'10.0.0.2', '10.0.0.2',
'192.168.0.1', '192.168.0.1',
'192.168.0.100', '192.168.0.100',
'192.168.0.250', '192.168.0.250',
'192.168.1.1', '192.168.1.1',
'192.168.1.123' '192.168.1.123'
]); ]);
}); });
test("space(s) as first character(s)", function () { test("space(s) as first character(s)", function () {
wrapTest( wrapTest(
['alpha',' 1',' 3',' 2',0], ['alpha',' 1',' 3',' 2',0],
[0,' 1',' 2',' 3','alpha']); [0,' 1',' 2',' 3','alpha']);
}); });
test("wireless controllers", function () { test("wireless controllers", function () {
wrapTest( wrapTest(
[ [
'00:14:0e:12:34:56','00:08:30:01:23:45.1', '00:14:0e:12:34:56','00:08:30:01:23:45.1',
'00:15:c7:ab:23:10.0','00:14:0e:01:23:45', '00:15:c7:ab:23:10.0','00:14:0e:01:23:45',
'00:08:30:01:23:45.0','00:15:c7:ab:23:00.1' '00:08:30:01:23:45.0','00:15:c7:ab:23:00.1'
], ],
[ [
'00:08:30:01:23:45.0','00:08:30:01:23:45.1', '00:08:30:01:23:45.0','00:08:30:01:23:45.1',
'00:14:0e:01:23:45','00:14:0e:12:34:56', '00:14:0e:01:23:45','00:14:0e:12:34:56',
'00:15:c7:ab:23:00.1','00:15:c7:ab:23:10.0' '00:15:c7:ab:23:00.1','00:15:c7:ab:23:10.0'
],'ap ports'); ],'ap ports');
wrapTest( wrapTest(
[ [
'wlan-controller1/0.104','wlan-controller1/0', 'wlan-controller1/0.104','wlan-controller1/0',
'wlan-controller1/0.252','wlan-controller1/0.103' 'wlan-controller1/0.252','wlan-controller1/0.103'
], ],
[ [
'wlan-controller1/0','wlan-controller1/0.103', 'wlan-controller1/0','wlan-controller1/0.103',
'wlan-controller1/0.104','wlan-controller1/0.252' 'wlan-controller1/0.104','wlan-controller1/0.252'
],'controller ports'); ],'controller ports');
}); });
test("ports", function () { test("ports", function () {
wrapTest( wrapTest(
[ [
'1.1','1.13','1.14','1.19','1.2','Vlan318','1.25', '1.1','1.13','1.14','1.19','1.2','Vlan318','1.25',
'1.29','3.12','1.3','1.37','1.38','1.4','1.43', '1.29','3.12','1.3','1.37','1.38','1.4','1.43',
'1.6','8.34' '1.6','8.34'
], ],
[ [
'1.1','1.2','1.3','1.4','1.6','1.13','1.14','1.19', '1.1','1.2','1.3','1.4','1.6','1.13','1.14','1.19',
'1.25','1.29','1.37','1.38','1.43','3.12','8.34', '1.25','1.29','1.37','1.38','1.43','3.12','8.34',
'Vlan318' 'Vlan318'
],'Avaya'); ],'Avaya');
wrapTest( wrapTest(
[ [
'GigabitEthernet9/0/12', 'GigabitEthernet9/0/12',
'GigabitEthernet9/0/11', 'GigabitEthernet9/0/11',
'GigabitEthernet1/0/14', 'GigabitEthernet1/0/14',
'GigabitEthernet1/1/12', 'GigabitEthernet1/1/12',
], ],
[ [
'GigabitEthernet1/0/14', 'GigabitEthernet1/0/14',
'GigabitEthernet1/1/12', 'GigabitEthernet1/1/12',
'GigabitEthernet9/0/11', 'GigabitEthernet9/0/11',
'GigabitEthernet9/0/12', 'GigabitEthernet9/0/12',
],'Cisco'); ],'Cisco');
wrapTest( wrapTest(
[ [
'1/1/1','0/1/1','0/3/20','0/2/1','0/3/1','0/3/2', '1/1/1','0/1/1','0/3/20','0/2/1','0/3/1','0/3/2',
'0/3/11','0/3/10' '0/3/11','0/3/10'
],[ ],[
'0/1/1','0/2/1','0/3/1','0/3/2','0/3/10','0/3/11', '0/1/1','0/2/1','0/3/1','0/3/2','0/3/10','0/3/11',
'0/3/20','1/1/1' '0/3/20','1/1/1'
],'Dell'); ],'Dell');
wrapTest( wrapTest(
[ [
'1:10','1:2','1:1','1:11' '1:10','1:2','1:1','1:11'
],[ ],[
'1:1','1:2','1:10','1:11' '1:1','1:2','1:10','1:11'
],'Extreme'); ],'Extreme');
wrapTest( wrapTest(
[ [
'10GigabitEthernet1/1/12', '10GigabitEthernet1/1/12',
'GigabitEthernet1/0/14', 'GigabitEthernet1/0/14',
'GigabitEthernet9/0/12', 'GigabitEthernet9/0/12',
'10GigabitEthernet9/0/11', '10GigabitEthernet9/0/11',
],[ ],[
'GigabitEthernet1/0/14', 'GigabitEthernet1/0/14',
'10GigabitEthernet1/1/12', '10GigabitEthernet1/1/12',
'10GigabitEthernet9/0/11', '10GigabitEthernet9/0/11',
'GigabitEthernet9/0/12', 'GigabitEthernet9/0/12',
],'Foundry 10Gb'); ],'Foundry 10Gb');
wrapTest( wrapTest(
[ [
'Slot: 1 Port: 2 Gigabit - Level', 'Slot: 1 Port: 2 Gigabit - Level',
'Slot: 1 Port: 1 Gigabit - Level', 'Slot: 1 Port: 1 Gigabit - Level',
'Slot: 0 Port: 15 Gigabit - Level', 'Slot: 0 Port: 15 Gigabit - Level',
'Slot: 1 Port: 10 Gigabit - Level', 'Slot: 1 Port: 10 Gigabit - Level',
'Slot: 0 Port: 1 Gigabit - Level' 'Slot: 0 Port: 1 Gigabit - Level'
],[ ],[
'Slot: 0 Port: 1 Gigabit - Level', 'Slot: 0 Port: 1 Gigabit - Level',
'Slot: 0 Port: 15 Gigabit - Level', 'Slot: 0 Port: 15 Gigabit - Level',
'Slot: 1 Port: 1 Gigabit - Level', 'Slot: 1 Port: 1 Gigabit - Level',
'Slot: 1 Port: 2 Gigabit - Level', 'Slot: 1 Port: 2 Gigabit - Level',
'Slot: 1 Port: 10 Gigabit - Level' 'Slot: 1 Port: 10 Gigabit - Level'
],'Netgear'); ],'Netgear');
wrapTest( wrapTest(
[ [
'port-channel190','port-channel19', 'port-channel190','port-channel19',
'port-channel1044','port-channel2','port-channel104' 'port-channel1044','port-channel2','port-channel104'
],[ ],[
'port-channel2','port-channel19','port-channel104', 'port-channel2','port-channel19','port-channel104',
'port-channel190','port-channel1044' 'port-channel190','port-channel1044'
],'port-channel'); ],'port-channel');
wrapTest( wrapTest(
[ [
'Serial1/1:5', 'Serial1/1:5',
'Serial2/0:5-Bearer Channel', 'Serial2/0:5-Bearer Channel',
'Serial2/0:20', 'Serial2/0:20',
@@ -191,7 +191,7 @@
'Serial2/0:21', 'Serial2/0:21',
'Serial2/0:5', 'Serial2/0:5',
'Serial2/0:20-Bearer Channel' 'Serial2/0:20-Bearer Channel'
],[ ],[
'Serial1/1:0', 'Serial1/1:0',
'Serial1/1:5', 'Serial1/1:5',
'Serial1/1:5-Bearer Channel', 'Serial1/1:5-Bearer Channel',
@@ -200,41 +200,41 @@
'Serial2/0:20', 'Serial2/0:20',
'Serial2/0:20-Bearer Channel', 'Serial2/0:20-Bearer Channel',
'Serial2/0:21' 'Serial2/0:21'
],'serial'); ],'serial');
wrapTest( wrapTest(
[ [
'unrouted VLAN 990','unrouted VLAN 95', 'unrouted VLAN 990','unrouted VLAN 95',
'unrouted VLAN 985','unrouted VLAN 99', 'unrouted VLAN 985','unrouted VLAN 99',
'unrouted VLAN 950' 'unrouted VLAN 950'
],[
'unrouted VLAN 95','unrouted VLAN 99',
'unrouted VLAN 950','unrouted VLAN 985',
'unrouted VLAN 990'
],'unrouted vlans');
wrapTest(
[
'Vlan10','Vlan910','Vlan1','Vlan91'
],[
'Vlan1','Vlan10','Vlan91','Vlan910'
],'vlans');
wrapTest(
[
'voice-port 2/10','voice-port 2/1','voice-port 2/2',
'voice-port 2/11'
],[
'voice-port 2/1','voice-port 2/2','voice-port 2/10',
'voice-port 2/11',
],'voice-port'); ],[
}); 'unrouted VLAN 95','unrouted VLAN 99',
'unrouted VLAN 950','unrouted VLAN 985',
'unrouted VLAN 990'
],'unrouted vlans');
wrapTest(
[
'Vlan10','Vlan910','Vlan1','Vlan91'
],[
'Vlan1','Vlan10','Vlan91','Vlan910'
],'vlans');
wrapTest(
[
'voice-port 2/10','voice-port 2/1','voice-port 2/2',
'voice-port 2/11'
],[
'voice-port 2/1','voice-port 2/2','voice-port 2/10',
'voice-port 2/11',
],'voice-port');
});
}); });
var sortFn = jQuery.fn.dataTableExt.oSort["portsort-asc"]; var sortFn = jQuery.fn.dataTableExt.oSort["portsort-asc"];
function wrapTest(origArray, sortArray, message) { function wrapTest(origArray, sortArray, message) {
deepEqual($.extend([], origArray).sort(sortFn), sortArray, (message ? message + ' - ' : '') + QUnit.jsDump.parse(origArray)); deepEqual($.extend([], origArray).sort(sortFn), sortArray, (message ? message + ' - ' : '') + QUnit.jsDump.parse(origArray));
}; };
</script> </script>
</head> </head>
<body> <body>
<div id="qunit"></div> <div id="qunit"></div>