add testcase similar to http://jsfiddle.net/bgrins/ctkY3/