{"version":3,"sources":["/source/pivot_spec.coffee","pivot_spec.min.js"],"names":["fixtureData","raggedFixtureData","name","colour","age","gender","describe","table","beforeEach","done","$","pivotUI","onRefresh","it","expect","find","length","toBe","val","text","join","data","rows","cols","aggregatorName","vals","rendererName","pivot","aggregators","derivers","ref","sortAs","pivotUtilities","aggregator","filter","record","derivedAttributes","birthyear","dateFormat","trialbins","bin","sorters","attr","received_PivotData","received_rendererOptions","count2x","push","this","value","format","x","renderer","a","b","addClass","greeting","rendererOptions","agg","getAggregator","sumOverSumOpts","aoaInput","pd","PivotData","aosInput","raggedAosInput","functionInput","tableInput","getRowKeys","toEqual","getColKeys","c","i","j","len","len1","numNotNull","numNull","r","ref1","records","forEachMatchingRecord","getVal","tpl","aggregatorTemplates","count","countUnique","listUnique","average","sum","min","max","first","last","median","quantile","stdev","sumOverSum","naturalSort","sortedArr","NaN","Infinity","slice","sort","numberFormat","nf","scaler","suffix","thousandsSep","decimalSep","prefix","digitsAfterDecimal","df","Date","binner","toBeNaN","call"],"mappings":"CAAA,WAAA,GAAAA,GAAAC,CAAAD,KACK,OAAW,SAAY,SAAa,WAAgB,SAAY,cAChE,OAAW,OAAY,OAAa,aAAgB,IAAY,KAChE,OAAW,SAAY,MAAa,aAAgB,GAAY,KAChE,OAAW,OAAY,OAAa,aAAgB,IAAY,KAChE,QAAW,SAAY,SAAa,aAAgB,IAAY,KAGrEC,IACKC,KAAM,OAAQC,OAAU,MAAOC,IAAO,KACtCF,KAAM,OAAQG,OAAU,WACxBH,KAAM,OAAQG,OAAU,OAAQD,IAAO,KACvCF,KAAM,MAAOG,OAAU,KAAMD,IAAO,KAGzCE,SAAS,cAAe,WC8GpB,MD7GAA,UAAS,qEAAuE,WAC5E,GAAAC,ECmCF,ODnCEA,GAAQ,KAERC,WAAW,SAACC,GCUZ,MDTIF,GAAQG,EAAE,SAASC,QAAQX,GAAaY,UAAWH,MACvDI,GAAG,gCAAiC,SAACJ,GCmBrC,MDlBIK,QAAOP,EAAMQ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\"1982-11-07\", 103, 12],\n [\"Jane\", \"female\", \"red\", \"1982-11-08\", 95, 25],\n [\"John\", \"male\", \"blue\", \"1982-12-08\", 112, 30],\n [\"Carol\", \"female\", \"yellow\", \"1983-12-08\", 102, 14]\n]\n\nraggedFixtureData = [\n {name: \"Nick\", \"colour\": \"red\", \"age\": 34}\n {name: \"Jane\", \"gender\": \"female\"}\n {name: \"John\", \"gender\": \"male\", \"age\": 12}\n {name: \"Jim\", \"gender\": null, \"age\": 12}\n]\n\ndescribe \"$.pivotUI()\", ->\n describe \"with no rows/cols, default count aggregator, default TableRenderer\", ->\n table = null\n\n beforeEach (done) ->\n table = $(\"
\").pivotUI fixtureData, onRefresh: done\n it \"has all the basic UI elements\", (done) ->\n expect table.find(\"td.pvtAxisContainer\").length\n .toBe 3\n expect table.find(\"td.pvtRendererArea\").length\n .toBe 1\n expect table.find(\"td.pvtVals\").length\n .toBe 1\n expect table.find(\"select.pvtRenderer\").length\n .toBe 1\n expect table.find(\"select.pvtAggregator\").length\n .toBe 1\n expect table.find(\"span.pvtAttr\").length\n .toBe 6\n done()\n\n it \"reflects its inputs\", (done) ->\n expect table.find(\"td.pvtUnused span.pvtAttr\").length\n .toBe 6\n expect table.find(\"select.pvtRenderer\").val()\n .toBe \"Table\"\n expect table.find(\"select.pvtAggregator\").val()\n .toBe \"Count\"\n done()\n\n it \"renders a table\", (done) ->\n expect table.find(\"table.pvtTable\").length\n .toBe 1\n done()\n\n\n describe \"its renderer output\", ->\n it \"has the correct type and number of cells\", (done) ->\n expect table.find(\"th.pvtTotalLabel\").length\n .toBe 1\n expect table.find(\"td.pvtGrandTotal\").length\n .toBe 1\n done()\n\n it \"has the correct textual representation\", (done) ->\n expect table.find(\"table.pvtTable\").text()\n .toBe [\"Totals\", \"4\"].join(\"\")\n done()\n\n it \"has a correct grand total with data value\", (done) ->\n expect table.find(\"td.pvtGrandTotal\").text()\n .toBe \"4\"\n expect table.find(\"td.pvtGrandTotal\").data(\"value\")\n .toBe 4\n done()\n\n describe \"with rows/cols, sum-over-sum aggregator, Heatmap renderer\", ->\n table = null\n\n beforeEach (done) ->\n table = $(\"
\").pivotUI fixtureData,\n rows: [\"gender\"], cols: [\"colour\"]\n aggregatorName: \"Sum over Sum\"\n vals: [\"successes\", \"trials\"]\n rendererName: \"Heatmap\"\n onRefresh: done\n\n it \"has all the basic UI elements\", (done) ->\n expect table.find(\"td.pvtAxisContainer\").length\n .toBe 3\n expect table.find(\"td.pvtRendererArea\").length\n .toBe 1\n expect table.find(\"td.pvtVals\").length\n .toBe 1\n expect table.find(\"select.pvtRenderer\").length\n .toBe 1\n expect table.find(\"select.pvtAggregator\").length\n .toBe 1\n expect table.find(\"span.pvtAttr\").length\n .toBe 6\n done()\n\n it \"reflects its inputs\", (done) ->\n expect table.find(\"td.pvtUnused span.pvtAttr\").length\n .toBe 4\n expect table.find(\"td.pvtRows span.pvtAttr\").length\n .toBe 1\n expect table.find(\"td.pvtCols span.pvtAttr\").length\n .toBe 1\n expect table.find(\"select.pvtRenderer\").val()\n .toBe \"Heatmap\"\n expect table.find(\"select.pvtAggregator\").val()\n .toBe \"Sum over Sum\"\n done()\n\n it \"renders a table\", (done) ->\n expect table.find(\"table.pvtTable\").length\n .toBe 1\n done()\n\n describe \"its renderer output\", ->\n it \"has the correct type and number of cells\", (done) ->\n expect table.find(\"th.pvtAxisLabel\").length\n .toBe 2\n expect table.find(\"th.pvtRowLabel\").length\n .toBe 2\n expect table.find(\"th.pvtColLabel\").length\n .toBe 3\n expect table.find(\"th.pvtTotalLabel\").length\n .toBe 2\n expect table.find(\"td.pvtVal\").length\n .toBe 6\n expect table.find(\"td.pvtTotal\").length\n .toBe 5\n expect table.find(\"td.pvtGrandTotal\").length\n .toBe 1\n done()\n\n it \"has the correct textual representation\", (done) ->\n expect table.find(\"table.pvtTable\").text()\n .toBe [\n \"colour\", \"blue\", \"red\", \"yellow\", \"Totals\",\n \"gender\",\n \"female\", \"0.26\", \"0.14\", \"0.20\",\n \"male\", \"0.20\", \"0.20\",\n \"Totals\", \"0.20\", \"0.26\", \"0.14\", \"0.20\"\n ].join(\"\")\n done()\n\n it \"has a correct spot-checked cell with data value\", (done) ->\n expect table.find(\"td.col0.row1\").text()\n .toBe \"0.20\"\n expect table.find(\"td.col0.row1\").data(\"value\")\n .toBe (12+30)/(103+112)\n done()\n\n describe \"with ragged input\", ->\n table = $(\"
\").pivotUI raggedFixtureData, rows: [\"gender\"], cols: [\"age\"]\n\n it \"renders a table with the correct textual representation\", ->\n expect table.find(\"table.pvtTable\").text()\n .toBe [\n \"age\", \"12\", \"34\", \"null\", \"Totals\"\n \"gender\",\n \"female\", \"1\", \"1\"\n \"male\", \"1\", \"1\"\n \"null\", \"1\", \"1\", \"2\"\n \"Totals\", \"2\", \"1\", \"1\", \"4\"\n ].join(\"\")\n\ndescribe \"$.pivot()\", ->\n\n describe \"with no rows/cols, default count aggregator, default TableRenderer\", ->\n table = $(\"
\").pivot fixtureData\n\n it \"renders a table\", ->\n expect table.find(\"table.pvtTable\").length\n .toBe 1\n\n describe \"its renderer output\", ->\n\n it \"has the correct textual representation\", ->\n expect table.find(\"table.pvtTable\").text()\n .toBe [\"Totals\", \"4\"].join(\"\")\n\n it \"has a correct grand total with data value\", ->\n expect table.find(\"td.pvtGrandTotal\").text()\n .toBe \"4\"\n expect table.find(\"td.pvtGrandTotal\").data(\"value\")\n .toBe 4\n\n describe \"with rows/cols, sum aggregator, derivedAttributes, filter and sorters\", ->\n {sortAs, derivers, aggregators} = $.pivotUtilities\n table = $(\"
\").pivot fixtureData,\n rows: [\"gender\"], cols: [\"birthyear\"], aggregator: aggregators[\"Sum\"]([\"trialbins\"])\n filter: (record) -> record.name != \"Nick\"\n derivedAttributes:\n birthyear: derivers.dateFormat \"birthday\", \"%y\"\n trialbins: derivers.bin \"trials\", 10\n sorters: (attr) ->\n if attr == \"gender\" then return sortAs([\"male\", \"female\"])\n\n it \"renders a table with the correct textual representation\", ->\n expect table.find(\"table.pvtTable\").text()\n .toBe [\n \"birthyear\", \"1982\", \"1983\", \"Totals\"\n \"gender\",\n \"male\", \"110.00\", \"110.00\"\n \"female\", \"90.00\", \"100.00\", \"190.00\"\n \"Totals\", \"200.00\", \"100.00\", \"300.00\"\n ].join(\"\")\n\n describe \"with rows/cols, fraction-of aggregator\", ->\n {aggregators} = $.pivotUtilities\n table = $(\"
\").pivot fixtureData,\n rows: [\"gender\"]\n aggregator: aggregators[\"Sum as Fraction of Total\"]([\"trials\"])\n\n it \"renders a table with the correct textual representation\", ->\n expect table.find(\"table.pvtTable\").text()\n .toBe [\n \"gender\", \"Totals\"\n \"female\", \"47.8%\"\n \"male\", \"52.2%\"\n \"Totals\", \"100.0%\"\n ].join(\"\")\n\n describe \"with rows/cols, custom aggregator, custom renderer with options\", ->\n received_PivotData = null\n received_rendererOptions = null\n\n table = $(\"
\").pivot fixtureData,\n rows: [\"name\", \"colour\"], cols: [\"trials\", \"successes\"]\n aggregator: ->\n count2x: 0\n push: -> @count2x +=2\n value: -> @count2x\n format: (x) -> \"formatted \" + x\n renderer: (a,b) ->\n received_PivotData = a\n received_rendererOptions = b\n return $(\"
\").addClass(b.greeting).text(\"world\")\n rendererOptions: {greeting:\"hithere\"}\n\n it \"renders the custom renderer as per options\", ->\n expect table.find(\"div.hithere\").length\n .toBe 1\n\n describe \"its received PivotData object\", ->\n it \"has a correct grand total value and format for custom aggregator\", ->\n agg = received_PivotData.getAggregator([],[])\n val = agg.value()\n expect(val).toBe 8\n expect(agg.format(val)).toBe \"formatted 8\"\n\n\n describe \"with ragged input\", ->\n table = $(\"
\").pivot raggedFixtureData, rows: [\"gender\"], cols: [\"age\"]\n\n it \"renders a table with the correct textual representation\", ->\n expect table.find(\"table.pvtTable\").text()\n .toBe [\n \"age\", \"12\", \"34\", \"null\", \"Totals\"\n \"gender\",\n \"female\", \"1\", \"1\"\n \"male\", \"1\", \"1\"\n \"null\", \"1\", \"1\", \"2\"\n \"Totals\", \"2\", \"1\", \"1\", \"4\"\n ].join(\"\")\n\ndescribe \"$.pivotUtilities\", ->\n\n describe \".PivotData()\", ->\n sumOverSumOpts =\n aggregator: $.pivotUtilities.aggregators[\"Sum over Sum\"]([\"a\",\"b\"])\n\n describe \"with no options\", ->\n aoaInput = [ [\"a\",\"b\"], [1,2], [3,4] ]\n pd = new $.pivotUtilities.PivotData aoaInput\n\n it \"has the correct grand total value\", ->\n expect pd.getAggregator([],[]).value()\n .toBe 2\n\n describe \"with array-of-array input\", ->\n aoaInput = [ [\"a\",\"b\"], [1,2], [3,4] ]\n pd = new $.pivotUtilities.PivotData aoaInput, sumOverSumOpts\n\n it \"has the correct grand total value\", ->\n expect pd.getAggregator([],[]).value()\n .toBe (1+3)/(2+4)\n\n describe \"with array-of-object input\", ->\n aosInput = [ {a:1, b:2}, {a:3, b:4} ]\n pd = new $.pivotUtilities.PivotData aosInput, sumOverSumOpts\n\n it \"has the correct grand total value\", ->\n expect pd.getAggregator([],[]).value()\n .toBe (1+3)/(2+4)\n\n describe \"with ragged array-of-object input\", ->\n raggedAosInput = [ {a:1}, {b:4}, {a: 3, b: 2} ]\n pd = new $.pivotUtilities.PivotData raggedAosInput, sumOverSumOpts\n\n it \"has the correct grand total value\", ->\n expect pd.getAggregator([],[]).value()\n .toBe (1+3)/(2+4)\n\n describe \"with function input\", ->\n functionInput = (record) ->\n record a:1, b:2\n record a:3, b:4\n pd = new $.pivotUtilities.PivotData functionInput, sumOverSumOpts\n\n it \"has the correct grand total value\", ->\n expect pd.getAggregator([],[]).value()\n .toBe (1+3)/(2+4)\n\n describe \"with jQuery table element input\", ->\n tableInput = $ \"\"\"\n \n \n \n \n \n \n \n \n
ab
1 2
3 4
\n \"\"\"\n pd = new $.pivotUtilities.PivotData tableInput, sumOverSumOpts\n\n it \"has the correct grand total value\", ->\n expect pd.getAggregator([],[]).value()\n .toBe (1+3)/(2+4)\n\n\n describe \"with rows/cols\", ->\n pd = new $.pivotUtilities.PivotData fixtureData,\n rows: [\"name\", \"colour\"],\n cols: [\"trials\", \"successes\"]\n\n it \"has correctly-ordered row keys\", ->\n expect pd.getRowKeys()\n .toEqual [ [ 'Carol', 'yellow' ], [ 'Jane', 'red' ], [ 'John', 'blue' ], [ 'Nick', 'blue' ] ]\n\n it \"has correctly-ordered col keys\", ->\n expect pd.getColKeys()\n .toEqual [ [ 95, 25 ], [ 102, 14 ], [ 103, 12 ], [ 112, 30 ] ]\n\n it \"can be iterated over\", ->\n numNotNull = 0\n numNull = 0\n for r in pd.getRowKeys()\n for c in pd.getColKeys()\n if pd.getAggregator(r, c).value()?\n numNotNull++\n else\n numNull++\n expect numNotNull\n .toBe 4\n expect numNull\n .toBe 12\n\n it \"returns matching records\", ->\n records = []\n pd.forEachMatchingRecord gender: \"male\", (x) -> records.push(x.name)\n expect records\n .toEqual [\"Nick\", \"John\"]\n\n it \"has a correct spot-checked aggregator\", ->\n agg = pd.getAggregator([ 'Carol', 'yellow' ],[ 102, 14 ])\n val = agg.value()\n expect(val).toBe 1\n expect(agg.format(val)).toBe \"1\"\n\n it \"has a correct grand total aggregator\", ->\n agg = pd.getAggregator([],[])\n val = agg.value()\n expect(val).toBe 4\n expect(agg.format(val)).toBe \"4\"\n\n describe \".aggregatorTemplates\", ->\n\n getVal = (aggregator) ->\n pd = new $.pivotUtilities.PivotData(fixtureData, {aggregator})\n return pd.getAggregator([],[]).value()\n tpl = $.pivotUtilities.aggregatorTemplates\n\n describe \".count\", ->\n it \"works\", ->\n expect getVal(tpl.count()())\n .toBe 4\n\n describe \".countUnique\", ->\n it \"works\", ->\n expect getVal(tpl.countUnique()(['gender']))\n .toBe 2\n\n describe \".listUnique\", ->\n it \"works\", ->\n expect getVal(tpl.listUnique()(['gender']))\n .toBe 'male,female'\n\n describe \".average\", ->\n it \"works\", ->\n expect getVal(tpl.average()(['trials']))\n .toBe 103\n\n describe \".sum\", ->\n it \"works\", ->\n expect getVal(tpl.sum()(['trials']))\n .toBe 412\n\n describe \".min\", ->\n it \"works\", ->\n expect getVal(tpl.min()(['trials']))\n .toBe 95\n\n describe \".max\", ->\n it \"works\", ->\n expect getVal(tpl.max()(['trials']))\n .toBe 112\n\n describe \".first\", ->\n it \"works\", ->\n expect getVal(tpl.first()(['name']))\n .toBe 'Carol'\n\n describe \".last\", ->\n it \"works\", ->\n expect getVal(tpl.last()(['name']))\n .toBe 'Nick'\n\n describe \".average\", ->\n it \"works\", ->\n expect getVal(tpl.average()(['trials']))\n .toBe 103\n\n describe \".median\", ->\n it \"works\", ->\n expect getVal(tpl.median()(['trials']))\n .toBe 102.5\n\n describe \".quantile\", ->\n it \"works\", ->\n expect getVal(tpl.quantile(0)(['trials']))\n .toBe 95\n expect getVal(tpl.quantile(0.1)(['trials']))\n .toBe 98.5\n expect getVal(tpl.quantile(0.25)(['trials']))\n .toBe 98.5\n expect getVal(tpl.quantile(1/3)(['trials']))\n .toBe 102\n expect getVal(tpl.quantile(1)(['trials']))\n .toBe 112\n\n describe \".var\", ->\n it \"works\", ->\n expect getVal(tpl.var()(['trials']))\n .toBe 48.666666666666686\n\n describe \".stdev\", ->\n it \"works\", ->\n expect getVal(tpl.stdev()(['trials']))\n .toBe 6.976149845485451\n\n describe \".sumOverSum\", ->\n it \"works\", ->\n expect getVal(tpl.sumOverSum()(['successes', 'trials']))\n .toBe (12+25+30+14)/(95+102+103+112)\n\n describe \".naturalSort()\", ->\n naturalSort = $.pivotUtilities.naturalSort\n\n sortedArr = [\n null, NaN,\n -Infinity, '-Infinity', -3, '-3', -2, '-2', -1, '-1',\n 0, '2e-1', 1, '01', '1', 2, '002', '002e0', '02', '2', '2e-0',\n 3, 10, '10', '11', '12', '1e2', '112', Infinity, 'Infinity',\n '1a', '2a','12a','20a',\n 'A', 'A', 'NaN', 'a', 'a',\n 'a01', 'a012', 'a02', 'a1', 'a2', 'a12', 'a12', 'a21', 'a21',\n 'b', 'c', 'd', 'null'\n ]\n\n it \"sorts naturally (null, NaN, numbers & numbery strings, Alphanum for text strings)\", ->\n expect sortedArr.slice().sort(naturalSort)\n .toEqual sortedArr\n\n describe \".sortAs()\", ->\n sortAs = $.pivotUtilities.sortAs\n\n it \"sorts with unknown values sorted at the end\", ->\n expect [5,2,3,4,1].sort sortAs([4,3,2])\n .toEqual [4,3,2,1,5]\n\n it \"sorts lowercase after uppercase\", ->\n expect [\"Ab\",\"aA\",\"aa\",\"ab\"].sort sortAs([\"Ab\",\"Aa\"])\n .toEqual [\"Ab\",\"ab\",\"aa\",\"aA\"]\n\n describe \".numberFormat()\", ->\n numberFormat = $.pivotUtilities.numberFormat\n\n it \"formats numbers\", ->\n nf = numberFormat()\n expect nf 1234567.89123456\n .toEqual \"1,234,567.89\"\n\n it \"formats booleans\", ->\n nf = numberFormat()\n expect nf true\n .toEqual \"1.00\"\n\n it \"formats numbers in strings\", ->\n nf = numberFormat()\n expect nf \"1234567.89123456\"\n .toEqual \"1,234,567.89\"\n\n it \"doesn't formats strings\", ->\n nf = numberFormat()\n expect nf \"hi there\"\n .toEqual \"\"\n\n it \"doesn't formats objects\", ->\n nf = numberFormat()\n expect nf {a:1}\n .toEqual \"\"\n\n it \"formats percentages\", ->\n nf = numberFormat(scaler: 100, suffix: \"%\")\n expect nf 0.12345\n .toEqual \"12.35%\"\n\n it \"adds separators\", ->\n nf = numberFormat(thousandsSep: \"a\", decimalSep: \"b\")\n expect nf 1234567.89123456\n .toEqual \"1a234a567b89\"\n\n it \"adds prefixes and suffixes\", ->\n nf = numberFormat(prefix: \"a\", suffix: \"b\")\n expect nf 1234567.89123456\n .toEqual \"a1,234,567.89b\"\n\n it \"scales and rounds\", ->\n nf = numberFormat(digitsAfterDecimal: 3, scaler: 1000)\n expect nf 1234567.89123456\n .toEqual \"1,234,567,891.235\"\n\n describe \".derivers\", ->\n describe \".dateFormat()\", ->\n df = $.pivotUtilities.derivers.dateFormat \"x\", \"abc % %% %%% %a %y %m %n %d %w %x %H %M %S\", true\n\n it \"formats date objects\", ->\n expect df {x: new Date(\"2015-01-02T23:43:11Z\")}\n .toBe 'abc % %% %%% %a 2015 01 Jan 02 Fri 5 23 43 11'\n\n it \"formats input parsed by Date.parse()\", ->\n expect df {x: \"2015-01-02T23:43:11Z\"}\n .toBe 'abc % %% %%% %a 2015 01 Jan 02 Fri 5 23 43 11'\n\n expect df {x: \"bla\"}\n .toBe ''\n\n describe \".bin()\", ->\n binner = $.pivotUtilities.derivers.bin \"x\", 10\n\n it \"bins numbers\", ->\n expect binner {x: 11}\n .toBe 10\n\n expect binner {x: 9}\n .toBe 0\n\n expect binner {x: 111}\n .toBe 110\n\n it \"bins booleans\", ->\n expect binner {x: true}\n .toBe 0\n\n it \"bins negative numbers\", ->\n expect binner {x: -12}\n .toBe -10\n\n it \"doesn't bin strings\", ->\n expect binner {x: \"a\"}\n .toBeNaN()\n\n it \"doesn't bin objects\", ->\n expect binner {x: {a:1}}\n .toBeNaN()\n","(function(){var t,e;t=[[\"name\",\"gender\",\"colour\",\"birthday\",\"trials\",\"successes\"],[\"Nick\",\"male\",\"blue\",\"1982-11-07\",103,12],[\"Jane\",\"female\",\"red\",\"1982-11-08\",95,25],[\"John\",\"male\",\"blue\",\"1982-12-08\",112,30],[\"Carol\",\"female\",\"yellow\",\"1983-12-08\",102,14]],e=[{name:\"Nick\",colour:\"red\",age:34},{name:\"Jane\",gender:\"female\"},{name:\"John\",gender:\"male\",age:12},{name:\"Jim\",gender:null,age:12}],describe(\"$.pivotUI()\",function(){return describe(\"with no rows/cols, default count aggregator, default TableRenderer\",function(){var e;return e=null,beforeEach(function(r){return e=$(\"
\").pivotUI(t,{onRefresh:r})}),it(\"has all the basic UI elements\",function(t){return expect(e.find(\"td.pvtAxisContainer\").length).toBe(3),expect(e.find(\"td.pvtRendererArea\").length).toBe(1),expect(e.find(\"td.pvtVals\").length).toBe(1),expect(e.find(\"select.pvtRenderer\").length).toBe(1),expect(e.find(\"select.pvtAggregator\").length).toBe(1),expect(e.find(\"span.pvtAttr\").length).toBe(6),t()}),it(\"reflects its inputs\",function(t){return expect(e.find(\"td.pvtUnused span.pvtAttr\").length).toBe(6),expect(e.find(\"select.pvtRenderer\").val()).toBe(\"Table\"),expect(e.find(\"select.pvtAggregator\").val()).toBe(\"Count\"),t()}),it(\"renders a table\",function(t){return expect(e.find(\"table.pvtTable\").length).toBe(1),t()}),describe(\"its renderer output\",function(){return it(\"has the correct type and number of cells\",function(t){return expect(e.find(\"th.pvtTotalLabel\").length).toBe(1),expect(e.find(\"td.pvtGrandTotal\").length).toBe(1),t()}),it(\"has the correct textual representation\",function(t){return expect(e.find(\"table.pvtTable\").text()).toBe([\"Totals\",\"4\"].join(\"\")),t()}),it(\"has a correct grand total with data value\",function(t){return expect(e.find(\"td.pvtGrandTotal\").text()).toBe(\"4\"),expect(e.find(\"td.pvtGrandTotal\").data(\"value\")).toBe(4),t()})})}),describe(\"with rows/cols, sum-over-sum aggregator, Heatmap renderer\",function(){var e;return e=null,beforeEach(function(r){return e=$(\"
\").pivotUI(t,{rows:[\"gender\"],cols:[\"colour\"],aggregatorName:\"Sum over Sum\",vals:[\"successes\",\"trials\"],rendererName:\"Heatmap\",onRefresh:r})}),it(\"has all the basic UI elements\",function(t){return expect(e.find(\"td.pvtAxisContainer\").length).toBe(3),expect(e.find(\"td.pvtRendererArea\").length).toBe(1),expect(e.find(\"td.pvtVals\").length).toBe(1),expect(e.find(\"select.pvtRenderer\").length).toBe(1),expect(e.find(\"select.pvtAggregator\").length).toBe(1),expect(e.find(\"span.pvtAttr\").length).toBe(6),t()}),it(\"reflects its inputs\",function(t){return expect(e.find(\"td.pvtUnused span.pvtAttr\").length).toBe(4),expect(e.find(\"td.pvtRows span.pvtAttr\").length).toBe(1),expect(e.find(\"td.pvtCols span.pvtAttr\").length).toBe(1),expect(e.find(\"select.pvtRenderer\").val()).toBe(\"Heatmap\"),expect(e.find(\"select.pvtAggregator\").val()).toBe(\"Sum over Sum\"),t()}),it(\"renders a table\",function(t){return expect(e.find(\"table.pvtTable\").length).toBe(1),t()}),describe(\"its renderer output\",function(){return it(\"has the correct type and number of cells\",function(t){return expect(e.find(\"th.pvtAxisLabel\").length).toBe(2),expect(e.find(\"th.pvtRowLabel\").length).toBe(2),expect(e.find(\"th.pvtColLabel\").length).toBe(3),expect(e.find(\"th.pvtTotalLabel\").length).toBe(2),expect(e.find(\"td.pvtVal\").length).toBe(6),expect(e.find(\"td.pvtTotal\").length).toBe(5),expect(e.find(\"td.pvtGrandTotal\").length).toBe(1),t()}),it(\"has the correct textual representation\",function(t){return expect(e.find(\"table.pvtTable\").text()).toBe([\"colour\",\"blue\",\"red\",\"yellow\",\"Totals\",\"gender\",\"female\",\"0.26\",\"0.14\",\"0.20\",\"male\",\"0.20\",\"0.20\",\"Totals\",\"0.20\",\"0.26\",\"0.14\",\"0.20\"].join(\"\")),t()}),it(\"has a correct spot-checked cell with data value\",function(t){return expect(e.find(\"td.col0.row1\").text()).toBe(\"0.20\"),expect(e.find(\"td.col0.row1\").data(\"value\")).toBe(42/215),t()})})}),describe(\"with ragged input\",function(){var t;return t=$(\"
\").pivotUI(e,{rows:[\"gender\"],cols:[\"age\"]}),it(\"renders a table with the correct textual representation\",function(){return expect(t.find(\"table.pvtTable\").text()).toBe([\"age\",\"12\",\"34\",\"null\",\"Totals\",\"gender\",\"female\",\"1\",\"1\",\"male\",\"1\",\"1\",\"null\",\"1\",\"1\",\"2\",\"Totals\",\"2\",\"1\",\"1\",\"4\"].join(\"\"))})})}),describe(\"$.pivot()\",function(){return describe(\"with no rows/cols, default count aggregator, default TableRenderer\",function(){var e;return e=$(\"
\").pivot(t),it(\"renders a table\",function(){return expect(e.find(\"table.pvtTable\").length).toBe(1)}),describe(\"its renderer output\",function(){return it(\"has the correct textual representation\",function(){return expect(e.find(\"table.pvtTable\").text()).toBe([\"Totals\",\"4\"].join(\"\"))}),it(\"has a correct grand total with data value\",function(){return expect(e.find(\"td.pvtGrandTotal\").text()).toBe(\"4\"),expect(e.find(\"td.pvtGrandTotal\").data(\"value\")).toBe(4)})})}),describe(\"with rows/cols, sum aggregator, derivedAttributes, filter and sorters\",function(){var e,r,n,a,o;return n=$.pivotUtilities,a=n.sortAs,r=n.derivers,e=n.aggregators,o=$(\"
\").pivot(t,{rows:[\"gender\"],cols:[\"birthyear\"],aggregator:e.Sum([\"trialbins\"]),filter:function(t){return\"Nick\"!==t.name},derivedAttributes:{birthyear:r.dateFormat(\"birthday\",\"%y\"),trialbins:r.bin(\"trials\",10)},sorters:function(t){return\"gender\"===t?a([\"male\",\"female\"]):void 0}}),it(\"renders a table with the correct textual representation\",function(){return expect(o.find(\"table.pvtTable\").text()).toBe([\"birthyear\",\"1982\",\"1983\",\"Totals\",\"gender\",\"male\",\"110.00\",\"110.00\",\"female\",\"90.00\",\"100.00\",\"190.00\",\"Totals\",\"200.00\",\"100.00\",\"300.00\"].join(\"\"))})}),describe(\"with rows/cols, fraction-of aggregator\",function(){var e,r;return e=$.pivotUtilities.aggregators,r=$(\"
\").pivot(t,{rows:[\"gender\"],aggregator:e[\"Sum as Fraction of Total\"]([\"trials\"])}),it(\"renders a table with the correct textual representation\",function(){return expect(r.find(\"table.pvtTable\").text()).toBe([\"gender\",\"Totals\",\"female\",\"47.8%\",\"male\",\"52.2%\",\"Totals\",\"100.0%\"].join(\"\"))})}),describe(\"with rows/cols, custom aggregator, custom renderer with options\",function(){var e,r,n;return e=null,r=null,n=$(\"
\").pivot(t,{rows:[\"name\",\"colour\"],cols:[\"trials\",\"successes\"],aggregator:function(){return{count2x:0,push:function(){return this.count2x+=2},value:function(){return this.count2x},format:function(t){return\"formatted \"+t}}},renderer:function(t,n){return e=t,r=n,$(\"
\").addClass(n.greeting).text(\"world\")},rendererOptions:{greeting:\"hithere\"}}),it(\"renders the custom renderer as per options\",function(){return expect(n.find(\"div.hithere\").length).toBe(1)}),describe(\"its received PivotData object\",function(){return it(\"has a correct grand total value and format for custom aggregator\",function(){var t,r;return t=e.getAggregator([],[]),r=t.value(),expect(r).toBe(8),expect(t.format(r)).toBe(\"formatted 8\")})})}),describe(\"with ragged input\",function(){var t;return t=$(\"
\").pivot(e,{rows:[\"gender\"],cols:[\"age\"]}),it(\"renders a table with the correct textual representation\",function(){return expect(t.find(\"table.pvtTable\").text()).toBe([\"age\",\"12\",\"34\",\"null\",\"Totals\",\"gender\",\"female\",\"1\",\"1\",\"male\",\"1\",\"1\",\"null\",\"1\",\"1\",\"2\",\"Totals\",\"2\",\"1\",\"1\",\"4\"].join(\"\"))})})}),describe(\"$.pivotUtilities\",function(){return describe(\".PivotData()\",function(){var e;return e={aggregator:$.pivotUtilities.aggregators[\"Sum over Sum\"]([\"a\",\"b\"])},describe(\"with no options\",function(){var t,e;return t=[[\"a\",\"b\"],[1,2],[3,4]],e=new $.pivotUtilities.PivotData(t),it(\"has the correct grand total value\",function(){return expect(e.getAggregator([],[]).value()).toBe(2)})}),describe(\"with array-of-array input\",function(){var t,r;return t=[[\"a\",\"b\"],[1,2],[3,4]],r=new $.pivotUtilities.PivotData(t,e),it(\"has the correct grand total value\",function(){return expect(r.getAggregator([],[]).value()).toBe(4/6)})}),describe(\"with array-of-object input\",function(){var t,r;return t=[{a:1,b:2},{a:3,b:4}],r=new $.pivotUtilities.PivotData(t,e),it(\"has the correct grand total value\",function(){return expect(r.getAggregator([],[]).value()).toBe(4/6)})}),describe(\"with ragged array-of-object input\",function(){var t,r;return r=[{a:1},{b:4},{a:3,b:2}],t=new $.pivotUtilities.PivotData(r,e),it(\"has the correct grand total value\",function(){return expect(t.getAggregator([],[]).value()).toBe(4/6)})}),describe(\"with function input\",function(){var t,r;return t=function(t){return t({a:1,b:2}),t({a:3,b:4})},r=new $.pivotUtilities.PivotData(t,e),it(\"has the correct grand total value\",function(){return expect(r.getAggregator([],[]).value()).toBe(4/6)})}),describe(\"with jQuery table element input\",function(){var t,r;return r=$(\"\\n \\n \\n \\n \\n \\n \\n \\n
ab
1 2
3 4
\"),t=new $.pivotUtilities.PivotData(r,e),it(\"has the correct grand total value\",function(){return expect(t.getAggregator([],[]).value()).toBe(4/6)})}),describe(\"with rows/cols\",function(){var e;return e=new $.pivotUtilities.PivotData(t,{rows:[\"name\",\"colour\"],cols:[\"trials\",\"successes\"]}),it(\"has correctly-ordered row keys\",function(){return expect(e.getRowKeys()).toEqual([[\"Carol\",\"yellow\"],[\"Jane\",\"red\"],[\"John\",\"blue\"],[\"Nick\",\"blue\"]])}),it(\"has correctly-ordered col keys\",function(){return expect(e.getColKeys()).toEqual([[95,25],[102,14],[103,12],[112,30]])}),it(\"can be iterated over\",function(){var t,r,n,a,o,i,c,u,s,l;for(i=0,c=0,s=e.getRowKeys(),r=0,a=s.length;a>r;r++)for(u=s[r],l=e.getColKeys(),n=0,o=l.length;o>n;n++)t=l[n],null!=e.getAggregator(u,t).value()?i++:c++;return expect(i).toBe(4),expect(c).toBe(12)}),it(\"returns matching records\",function(){var t;return t=[],e.forEachMatchingRecord({gender:\"male\"},function(e){return t.push(e.name)}),expect(t).toEqual([\"Nick\",\"John\"])}),it(\"has a correct spot-checked aggregator\",function(){var t,r;return t=e.getAggregator([\"Carol\",\"yellow\"],[102,14]),r=t.value(),expect(r).toBe(1),expect(t.format(r)).toBe(\"1\")}),it(\"has a correct grand total aggregator\",function(){var t,r;return t=e.getAggregator([],[]),r=t.value(),expect(r).toBe(4),expect(t.format(r)).toBe(\"4\")})})}),describe(\".aggregatorTemplates\",function(){var e,r;return e=function(e){var r;return r=new $.pivotUtilities.PivotData(t,{aggregator:e}),r.getAggregator([],[]).value()},r=$.pivotUtilities.aggregatorTemplates,describe(\".count\",function(){return it(\"works\",function(){return expect(e(r.count()())).toBe(4)})}),describe(\".countUnique\",function(){return it(\"works\",function(){return expect(e(r.countUnique()([\"gender\"]))).toBe(2)})}),describe(\".listUnique\",function(){return it(\"works\",function(){return expect(e(r.listUnique()([\"gender\"]))).toBe(\"male,female\")})}),describe(\".average\",function(){return it(\"works\",function(){return expect(e(r.average()([\"trials\"]))).toBe(103)})}),describe(\".sum\",function(){return it(\"works\",function(){return expect(e(r.sum()([\"trials\"]))).toBe(412)})}),describe(\".min\",function(){return it(\"works\",function(){return expect(e(r.min()([\"trials\"]))).toBe(95)})}),describe(\".max\",function(){return it(\"works\",function(){return expect(e(r.max()([\"trials\"]))).toBe(112)})}),describe(\".first\",function(){return it(\"works\",function(){return expect(e(r.first()([\"name\"]))).toBe(\"Carol\")})}),describe(\".last\",function(){return it(\"works\",function(){return expect(e(r.last()([\"name\"]))).toBe(\"Nick\")})}),describe(\".average\",function(){return it(\"works\",function(){return expect(e(r.average()([\"trials\"]))).toBe(103)})}),describe(\".median\",function(){return it(\"works\",function(){return expect(e(r.median()([\"trials\"]))).toBe(102.5)})}),describe(\".quantile\",function(){return it(\"works\",function(){return expect(e(r.quantile(0)([\"trials\"]))).toBe(95),expect(e(r.quantile(.1)([\"trials\"]))).toBe(98.5),expect(e(r.quantile(.25)([\"trials\"]))).toBe(98.5),expect(e(r.quantile(1/3)([\"trials\"]))).toBe(102),expect(e(r.quantile(1)([\"trials\"]))).toBe(112)})}),describe(\".var\",function(){return it(\"works\",function(){return expect(e(r[\"var\"]()([\"trials\"]))).toBe(48.666666666666686)})}),describe(\".stdev\",function(){return it(\"works\",function(){return expect(e(r.stdev()([\"trials\"]))).toBe(6.976149845485451)})}),describe(\".sumOverSum\",function(){return it(\"works\",function(){return expect(e(r.sumOverSum()([\"successes\",\"trials\"]))).toBe(81/412)})})}),describe(\".naturalSort()\",function(){var t,e;return t=$.pivotUtilities.naturalSort,e=[null,0/0,-(1/0),\"-Infinity\",-3,\"-3\",-2,\"-2\",-1,\"-1\",0,\"2e-1\",1,\"01\",\"1\",2,\"002\",\"002e0\",\"02\",\"2\",\"2e-0\",3,10,\"10\",\"11\",\"12\",\"1e2\",\"112\",1/0,\"Infinity\",\"1a\",\"2a\",\"12a\",\"20a\",\"A\",\"A\",\"NaN\",\"a\",\"a\",\"a01\",\"a012\",\"a02\",\"a1\",\"a2\",\"a12\",\"a12\",\"a21\",\"a21\",\"b\",\"c\",\"d\",\"null\"],it(\"sorts naturally (null, NaN, numbers & numbery strings, Alphanum for text strings)\",function(){return expect(e.slice().sort(t)).toEqual(e)})}),describe(\".sortAs()\",function(){var t;return t=$.pivotUtilities.sortAs,it(\"sorts with unknown values sorted at the end\",function(){return expect([5,2,3,4,1].sort(t([4,3,2]))).toEqual([4,3,2,1,5])}),it(\"sorts lowercase after uppercase\",function(){return expect([\"Ab\",\"aA\",\"aa\",\"ab\"].sort(t([\"Ab\",\"Aa\"]))).toEqual([\"Ab\",\"ab\",\"aa\",\"aA\"])})}),describe(\".numberFormat()\",function(){var t;return t=$.pivotUtilities.numberFormat,it(\"formats numbers\",function(){var e;return e=t(),expect(e(1234567.89123456)).toEqual(\"1,234,567.89\")}),it(\"formats booleans\",function(){var e;return e=t(),expect(e(!0)).toEqual(\"1.00\")}),it(\"formats numbers in strings\",function(){var e;return e=t(),expect(e(\"1234567.89123456\")).toEqual(\"1,234,567.89\")}),it(\"doesn't formats strings\",function(){var e;return e=t(),expect(e(\"hi there\")).toEqual(\"\")}),it(\"doesn't formats objects\",function(){var e;return e=t(),expect(e({a:1})).toEqual(\"\")}),it(\"formats percentages\",function(){var e;return e=t({scaler:100,suffix:\"%\"}),expect(e(.12345)).toEqual(\"12.35%\")}),it(\"adds separators\",function(){var e;return e=t({thousandsSep:\"a\",decimalSep:\"b\"}),expect(e(1234567.89123456)).toEqual(\"1a234a567b89\")}),it(\"adds prefixes and suffixes\",function(){var e;return e=t({prefix:\"a\",suffix:\"b\"}),expect(e(1234567.89123456)).toEqual(\"a1,234,567.89b\")}),it(\"scales and rounds\",function(){var e;return e=t({digitsAfterDecimal:3,scaler:1e3}),expect(e(1234567.89123456)).toEqual(\"1,234,567,891.235\")})}),describe(\".derivers\",function(){return describe(\".dateFormat()\",function(){var t;return t=$.pivotUtilities.derivers.dateFormat(\"x\",\"abc % %% %%% %a %y %m %n %d %w %x %H %M %S\",!0),it(\"formats date objects\",function(){return expect(t({x:new Date(\"2015-01-02T23:43:11Z\")})).toBe(\"abc % %% %%% %a 2015 01 Jan 02 Fri 5 23 43 11\")}),it(\"formats input parsed by Date.parse()\",function(){return expect(t({x:\"2015-01-02T23:43:11Z\"})).toBe(\"abc % %% %%% %a 2015 01 Jan 02 Fri 5 23 43 11\"),expect(t({x:\"bla\"})).toBe(\"\")})}),describe(\".bin()\",function(){var t;return t=$.pivotUtilities.derivers.bin(\"x\",10),it(\"bins numbers\",function(){return expect(t({x:11})).toBe(10),expect(t({x:9})).toBe(0),expect(t({x:111})).toBe(110)}),it(\"bins booleans\",function(){return expect(t({x:!0})).toBe(0)}),it(\"bins negative numbers\",function(){return expect(t({x:-12})).toBe(-10)}),it(\"doesn't bin strings\",function(){return expect(t({x:\"a\"})).toBeNaN()}),it(\"doesn't bin objects\",function(){return expect(t({x:{a:1}})).toBeNaN()})})})})}).call(this);\n//# sourceMappingURL=pivot_spec.min.js.map"],"sourceRoot":"/source/"}