d3 test working with $timeout