comparison src/testdir/test3.ok @ 2968:c296c225736e v7.3.256

updated for version 7.3.256 Problem: Javascript indenting not sufficiently tested. Solution: Add more tests. (Luc Deschenaux) Mark the lines that are indented wrong.
author Bram Moolenaar <bram@vim.org>
date Wed, 20 Jul 2011 15:09:43 +0200
parents 9f71f5a526af
children 0ecfe54a273f
comparison
equal deleted inserted replaced
2967:42c8b385b993 2968:c296c225736e
1441 "y": 5 1441 "y": 5
1442 } 1442 }
1443 } 1443 }
1444 JSEND 1444 JSEND
1445 1445
1446
1447 JSSTART
1448 var foo = [
1449 1, // indent 8 more
1450 2,
1451 3
1452 ]; // indent 8 less
1453 JSEND
1454
1455
1456 JSSTART
1457 function bar() {
1458 var foo = [
1459 1,
1460 2,
1461 3
1462 ]; // indent 16 less
1463 }
1464 JSEND
1465
1466
1467 JSSTART
1468 (function($){
1469
1470 var class_name='myclass';
1471
1472 function private_method() {
1473 }
1474
1475 var public_method={
1476 method: function(options,args){
1477 private_method();
1478 }
1479 }
1480
1481 function init(options) {
1482
1483 $(this).data(class_name+'_public',$.extend({},{
1484 foo: 'bar',
1485 bar: 2, // indent 8 more
1486 foobar: [ // indent 8 more
1487 1, // indent 8 more
1488 2, // indent 16 more
1489 3 // indent 16 more
1490 ],
1491 callback: function(){ // indent 8 more
1492 return true; // indent 8 more
1493 } // indent 8 more
1494 }, options||{}));
1495 }
1496
1497 $.fn[class_name]=function() {
1498
1499 var _arguments=arguments;
1500 return this.each(function(){
1501
1502 var options=$(this).data(class_name+'_public');
1503 if (!options) {
1504 init.apply(this,_arguments);
1505
1506 } else {
1507 var method=public_method[_arguments[0]];
1508
1509 if (typeof(method)!='function') {
1510 console.log(class_name+' has no method "'+_arguments[0]+'"');
1511 return false;
1512 }
1513 _arguments[0]=options;
1514 method.apply(this,_arguments);
1515 }
1516 });
1517 }
1518
1519 })(jQuery);
1520 JSEND
1521
1522
1523 JSSTART
1524 function init(options) {
1525 $(this).data(class_name+'_public',$.extend({},{
1526 foo: 'bar',
1527 bar: 2,
1528 foobar: [
1529 1, // indent 8 more
1530 2, // indent 8 more
1531 3 // indent 8 more
1532 ],
1533 callback: function(){
1534 return true;
1535 }
1536 }, options||{}));
1537 }
1538 JSEND
1539
1540
1541 JSSTART
1542 (function($){
1543 function init(options) {
1544 $(this).data(class_name+'_public',$.extend({},{
1545 foo: 'bar',
1546 bar: 2, // indent 8 more
1547 foobar: [ // indent 8 more
1548 1, // indent 8 more
1549 2, // indent 16 more
1550 3 // indent 16 more
1551 ],
1552 callback: function(){ // indent 8 more
1553 return true; // indent 8 more
1554 } // indent 8 more
1555 }, options||{}));
1556 }
1557 })(jQuery);
1558 JSEND
1559