Hello everyone, So finally we have been at the end of the project and I really enjoyed each and every part of it. So after unit testing the transform its time to write functional tests and integration tests or we can say the browser tests for our add-on.
I have written the functional tests to ensure that the new add-on is imported and all the profiles are installed and the editor is using our new transform and not the old transform. So for that we have already implemented the registration of new add-on to replace it with old one and we also have to make tinyMCE uses our new transform.
How to make tinyMCE uses our new transform in place of old transfrom ?
So for understanding that we should have the idea how tinyMCE calls for the transform script. So it uses getToolByName in portal_transform to get the required transform. So tinyMCE search for safe_html in portal_transform and the old transform was named safe_html.
So here we had two ways to proceed :-
1) Either change tinyMCE configuration such that it calls for exp_safe_html instead of safe_html
2) Or we can just rename our transform same as safe_html and not some other name.
We choose the second one because lets assume the case(first one) when user just deregistered our add-on and wants to filter HTML with old transform and now lets assume we have changed the tinyMCE configuration such that it calls for exp_safe_html then it will cause error in that case and the tinyMCE will fail to create new page.
So finally we changed the name of our transform same as old one so that tinyMCE sense it like a normal thing and no change. :P
After that I tried to add my new add-on to new plone instance and tried to install that add-on in my plone site and it worked!!
Yayayay!!! So things going good and then also I tried to import the new add-on from the portal_transform and checked the terminal and it shows that all the required things are importing and then also tried to create a new page and the filtering is working perfectly.
Here is the screen shot of terminal
Its always great to get a good feedback from mentor :P
Hope you like it.
Cheers,
I have written the functional tests to ensure that the new add-on is imported and all the profiles are installed and the editor is using our new transform and not the old transform. So for that we have already implemented the registration of new add-on to replace it with old one and we also have to make tinyMCE uses our new transform.
How to make tinyMCE uses our new transform in place of old transfrom ?
So for understanding that we should have the idea how tinyMCE calls for the transform script. So it uses getToolByName in portal_transform to get the required transform. So tinyMCE search for safe_html in portal_transform and the old transform was named safe_html.
So here we had two ways to proceed :-
1) Either change tinyMCE configuration such that it calls for exp_safe_html instead of safe_html
2) Or we can just rename our transform same as safe_html and not some other name.
We choose the second one because lets assume the case(first one) when user just deregistered our add-on and wants to filter HTML with old transform and now lets assume we have changed the tinyMCE configuration such that it calls for exp_safe_html then it will cause error in that case and the tinyMCE will fail to create new page.
So finally we changed the name of our transform same as old one so that tinyMCE sense it like a normal thing and no change. :P
After that I tried to add my new add-on to new plone instance and tried to install that add-on in my plone site and it worked!!
Yayayay!!! So things going good and then also I tried to import the new add-on from the portal_transform and checked the terminal and it shows that all the required things are importing and then also tried to create a new page and the filtering is working perfectly.
Here is the screen shot of terminal
Its always great to get a good feedback from mentor :P
Hope you like it.
Cheers,
Comments
Post a Comment