add unit test for widget factory