add test for listeners declared in a function.