@@ -1643,10 +1643,7 @@ describe('Test lib.js:', function() {
16431643 // this is what got us into trouble actually - d3 selections can
16441644 // contain non-nodes - say for example d3 selections! then they
16451645 // don't work correctly. But it makes a convenient test!
1646- d3 . select ( 1 ) ,
1647- // just showing what we actually do in this function: duck type
1648- // using the `classed` method.
1649- { classed : function ( v ) { return ! ! v ; } }
1646+ d3 . select ( 1 )
16501647 ] ;
16511648
16521649 yesSelections . forEach ( function ( v ) {
@@ -1675,28 +1672,25 @@ describe('Test lib.js:', function() {
16751672 var stashLogLevel ;
16761673 var stashOnGraphLogLevel ;
16771674
1678- function consoleFn ( name , hasApply , messages ) {
1675+ function consoleFn ( name , messages ) {
16791676 var out = function ( ) {
1680- if ( hasApply ) expect ( this ) . toBe ( window . console ) ;
16811677 var args = [ ] ;
16821678 for ( var i = 0 ; i < arguments . length ; i ++ ) args . push ( arguments [ i ] ) ;
16831679 messages . push ( [ name , args ] ) ;
16841680 } ;
16851681
1686- if ( ! hasApply ) out . apply = undefined ;
1687-
16881682 return out ;
16891683 }
16901684
1691- function mockConsole ( hasApply , hasTrace , hasError ) {
1685+ function mockConsole ( ) {
16921686 var out = {
16931687 MESSAGES : [ ]
16941688 } ;
1695- out . log = consoleFn ( 'log' , hasApply , out . MESSAGES ) ;
1689+ out . log = consoleFn ( 'log' , out . MESSAGES ) ;
16961690
1697- if ( hasError ) out . error = consoleFn ( 'error' , hasApply , out . MESSAGES ) ;
1691+ out . error = consoleFn ( 'error' , out . MESSAGES ) ;
16981692
1699- if ( hasTrace ) out . trace = consoleFn ( 'trace' , hasApply , out . MESSAGES ) ;
1693+ out . trace = consoleFn ( 'trace' , out . MESSAGES ) ;
17001694
17011695 return out ;
17021696 }
@@ -1713,8 +1707,8 @@ describe('Test lib.js:', function() {
17131707 config . notifyOnLogging = stashOnGraphLogLevel ;
17141708 } ) ;
17151709
1716- it ( 'emits one console message if apply is available ' , function ( ) {
1717- var c = window . console = mockConsole ( true , true , true ) ;
1710+ it ( 'emits one console message' , function ( ) {
1711+ var c = window . console = mockConsole ( ) ;
17181712 config . logging = 2 ;
17191713
17201714 Lib . log ( 'tick' , 'tock' , 'tick' , 'tock' , 1 ) ;
@@ -1728,50 +1722,8 @@ describe('Test lib.js:', function() {
17281722 ] ) ;
17291723 } ) ;
17301724
1731- it ( 'falls back on console.log if no trace' , function ( ) {
1732- var c = window . console = mockConsole ( true , false , true ) ;
1733- config . logging = 2 ;
1734-
1735- Lib . log ( 'Hi' ) ;
1736- Lib . warn ( 42 ) ;
1737-
1738- expect ( c . MESSAGES ) . toEqual ( [
1739- [ 'log' , [ 'LOG:' , 'Hi' ] ] ,
1740- [ 'log' , [ 'WARN:' , 42 ] ]
1741- ] ) ;
1742- } ) ;
1743-
1744- it ( 'falls back on separate calls if no apply' , function ( ) {
1745- var c = window . console = mockConsole ( false , false , true ) ;
1746- config . logging = 2 ;
1747-
1748- Lib . log ( 'tick' , 'tock' , 'tick' , 'tock' , 1 ) ;
1749- Lib . warn ( 'I\'m' , 'a' , 'little' , 'cuckoo' , 'clock' , [ 1 , 2 ] ) ;
1750- Lib . error ( 'cuckoo!' , 'cuckoo!!!' , { a : 1 , b : 2 } ) ;
1751-
1752- expect ( c . MESSAGES ) . toEqual ( [
1753- [ 'log' , [ 'LOG:' ] ] ,
1754- [ 'log' , [ 'tick' ] ] ,
1755- [ 'log' , [ 'tock' ] ] ,
1756- [ 'log' , [ 'tick' ] ] ,
1757- [ 'log' , [ 'tock' ] ] ,
1758- [ 'log' , [ 1 ] ] ,
1759- [ 'log' , [ 'WARN:' ] ] ,
1760- [ 'log' , [ 'I\'m' ] ] ,
1761- [ 'log' , [ 'a' ] ] ,
1762- [ 'log' , [ 'little' ] ] ,
1763- [ 'log' , [ 'cuckoo' ] ] ,
1764- [ 'log' , [ 'clock' ] ] ,
1765- [ 'log' , [ [ 1 , 2 ] ] ] ,
1766- [ 'error' , [ 'ERROR:' ] ] ,
1767- [ 'error' , [ 'cuckoo!' ] ] ,
1768- [ 'error' , [ 'cuckoo!!!' ] ] ,
1769- [ 'error' , [ { a : 1 , b : 2 } ] ]
1770- ] ) ;
1771- } ) ;
1772-
17731725 it ( 'omits .log at log level 1' , function ( ) {
1774- var c = window . console = mockConsole ( true , true , true ) ;
1726+ var c = window . console = mockConsole ( ) ;
17751727 config . logging = 1 ;
17761728
17771729 Lib . log ( 1 ) ;
@@ -1785,7 +1737,7 @@ describe('Test lib.js:', function() {
17851737 } ) ;
17861738
17871739 it ( 'logs nothing at log level 0' , function ( ) {
1788- var c = window . console = mockConsole ( true , true , true ) ;
1740+ var c = window . console = mockConsole ( ) ;
17891741 config . logging = 0 ;
17901742
17911743 Lib . log ( 1 ) ;
@@ -1795,22 +1747,6 @@ describe('Test lib.js:', function() {
17951747 expect ( c . MESSAGES ) . toEqual ( [ ] ) ;
17961748 } ) ;
17971749
1798- it ( 'falls back on simple log if there is no console.error' , function ( ) {
1799- // TODO
1800-
1801- var c = window . console = mockConsole ( true , true , false ) ;
1802- config . logging = 2 ;
1803-
1804- Lib . error ( 'who are you' , 'who who... are you' , { a : 1 , b : 2 } ) ;
1805-
1806- expect ( c . MESSAGES ) . toEqual ( [
1807- [ 'log' , [ 'ERROR:' ] ] ,
1808- [ 'log' , [ 'who are you' ] ] ,
1809- [ 'log' , [ 'who who... are you' ] ] ,
1810- [ 'log' , [ { a : 1 , b : 2 } ] ]
1811- ] ) ;
1812- } ) ;
1813-
18141750 describe ( 'should log message in notifier div in accordance notifyOnLogging config option' , function ( ) {
18151751 var query = '.notifier-note' ;
18161752
0 commit comments