fix code style and add test for ComponentDidEnter