add unit tests for widget factory