hebasta | 8fe7438 | 2018-06-19 16:57:36 +0200 | [diff] [blame] | 1 | /** |
| 2 | * Test suite for corpus statistic |
| 3 | * |
| 4 | * @author Helge Stallkamp |
| 5 | */ |
| 6 | |
| 7 | |
| 8 | define(['vc'], function(){ |
| 9 | |
| 10 | |
| 11 | describe('KorAP.CorpusStat', function(){ |
| 12 | |
| 13 | var preDefinedStat={ |
| 14 | "documents":12, |
| 15 | "tokens":2323, |
| 16 | "sentences":343434, |
| 17 | "paragraphs":45454545 |
| 18 | }; |
| 19 | |
| 20 | var statClass = require("vc/statistic"); |
| 21 | var stat = statClass.create(preDefinedStat); |
| 22 | var descL = stat.element(); |
| 23 | |
| 24 | it('should be initiable', function(){ |
| 25 | expect(stat._visibleStat).toEqual(false); |
| 26 | expect( function() { statClass.create() }).toThrow(new Error("Missing parameter")); |
| 27 | }); |
| 28 | |
| 29 | |
| 30 | it('should be parsed in a statistic view and displayed as HTML Description List', function(){ |
| 31 | expect(descL.tagName).toEqual('DL'); |
| 32 | expect(descL.children[0].tagName).toEqual('DIV'); |
| 33 | expect(descL.children[0].children[0].tagName).toEqual('DT'); |
| 34 | expect(descL.children[0].children[0].attributes[0].name).toEqual('title'); |
| 35 | expect(descL.children[0].children[1].tagName).toEqual('DD'); |
| 36 | |
| 37 | expect(descL.children[0].children[0].firstChild.nodeValue).toEqual('documents'); |
| 38 | expect(descL.children[0].children[1].firstChild.nodeValue).toEqual('12'); |
| 39 | expect(descL.children[0].children[0].attributes[0].value).toEqual('documents'); |
| 40 | |
| 41 | }); |
| 42 | |
| 43 | |
| 44 | }); |
| 45 | }); |