From 37d59baa6ff494e8ea14f9f1863ae3deec5f8ac4 Mon Sep 17 00:00:00 2001 From: IntelOrca Date: Sun, 31 Aug 2014 11:11:19 +0100 Subject: [PATCH] add tests for jquery-handsontable --- .../jquery-handsontable-tests.ts | 28 +++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 jquery-handsontable/jquery-handsontable-tests.ts diff --git a/jquery-handsontable/jquery-handsontable-tests.ts b/jquery-handsontable/jquery-handsontable-tests.ts new file mode 100644 index 0000000000..b17e6fffa0 --- /dev/null +++ b/jquery-handsontable/jquery-handsontable-tests.ts @@ -0,0 +1,28 @@ +/// +/// + +var data = [ + ["", "Maserati", "Mazda", "Mercedes", "Mini", "Mitsubishi"], + ["2009", 0, 2941, 4303, 354, 5814], + ["2010", 5, 2905, 2867, 412, 5284], + ["2011", 4, 2517, 4822, 552, 6127], + ["2012", 2, 2422, 5399, 776, 4151] +]; + +var div = $('div'); +$('body').append(div); + +div.handsontable({ + data: data, + minSpareRows: 1, + colHeaders: true, + contextMenu: true +}); + +var instance: Handsontable.Context = div.handsontable('getInstance'); +for (var i = 1; i < instance.countCols(); i++) { + for (var j = 1; j < instance.countRows(); j++) { + var value = parseInt(instance.getDataAtCell(j, i)) * 2; + instance.setDataAtCell(j, i, value); + } +} \ No newline at end of file