<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Sun, May 24, 2015 at 10:08 PM, 章浩 <span dir="ltr"><<a href="mailto:jason.daurus@gmail.com" target="_blank">jason.daurus@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr">
<p style="margin-bottom:0in;line-height:0.25in;background-image:initial;background-repeat:initial">
<font color="#000000"><font face="Lucida Grande, serif"><font style="font-size:10pt">Hi
Singh,</font></font></font></p>
<p style="margin-bottom:0in;line-height:0.25in;background-image:initial;background-repeat:initial">
<font color="#000000"><font face="Lucida Grande, serif"><font style="font-size:10pt">Recently
I am working on templates of `tbl_column_definitions.lib.php`, and I
need some help from you.</font></font></font></p>
<p style="margin-bottom:0in;line-height:0.25in;background-image:initial;background-repeat:initial">
<font color="#000000"><font face="Lucida Grande, serif"><font style="font-size:10pt">I
met a problem on the unit test:</font></font></font></p>
<p style="margin-bottom:0in;line-height:0.25in;background-image:initial;background-repeat:initial">
<img src="cid:ii_14d86c1587f79c52" alt="Inline image 1" width="544" height="94"></p>
<p style="margin-bottom:0in;line-height:0.25in;background-image:initial;background-repeat:initial">
<font color="#000000"><font face="Lucida Grande, serif"><font style="font-size:10pt">And
here is the test code raise the problem:</font></font></font></p>
<p style="margin-bottom:0in;line-height:0.25in;background-image:initial;background-repeat:initial">
<img src="cid:ii_14d86c158525824a" alt="Inline image 2" width="366" height="89"></p>
<p style="margin-bottom:0in;line-height:0.25in;background-image:initial;background-repeat:initial"><font color="#000000"><font face="Lucida Grande, serif"><font style="font-size:10pt">The failure is caused by the format of HTML, which will not cause any side effects for user interface. So what
should I do to handle this kind of error? Merging spaces in a HTML
tag may help, but it seems difficult to distinguish a special case:</font></font></font></p>
<p style="margin-bottom:0in;line-height:0.25in;background-image:initial;background-repeat:initial">
<font color="#000000"><font face="Lucida Grande, serif"><font style="font-size:10pt"><i>Before
trimming:</i></font></font></font></p>
<p style="margin-bottom:0in;line-height:0.25in;background-image:initial;background-repeat:initial">
<font color="#0000ff"><font face="Lucida Grande, serif"><font style="font-size:10pt"><script>someScript();
//</font></font></font></p>
<p style="margin-bottom:0in;line-height:0.25in;background-image:initial;background-repeat:initial">
<font color="#0000ff"><font face="Lucida Grande, serif"><font style="font-size:10pt">anotherScript();</script></font></font></font></p>
<p style="margin-bottom:0in;line-height:0.25in;background-image:initial;background-repeat:initial">
<font color="#000000"><font face="Lucida Grande, serif"><font style="font-size:10pt"><i>After
trimming:</i></font></font></font></p>
<p style="margin-bottom:0in;line-height:0.25in;background-image:initial;background-repeat:initial">
<font color="#0000ff"><font face="Lucida Grande, serif"><font style="font-size:10pt"><script>someScript();
// anotherScript();</script></font></font></font></p>
<p style="margin-bottom:0in;line-height:0.25in;background-image:initial;background-repeat:initial">
<font color="#000000"><font face="Lucida Grande, serif"><font style="font-size:10pt">It's
obvious that it will cause some Javascripts being commented. Then I
figured out a second solution: modify the test scripts and let it
pass. This is a "palliative" solution, we have to spend
plenty of time to fix this kind of problems. </font></font></font>
</p>
<p style="margin-bottom:0in;line-height:0.25in;background-image:initial;background-repeat:initial"><span style="font-size:10pt;font-family:'Lucida Grande',serif;color:rgb(0,0,0);line-height:0.25in">Maybe
we could use a more effective way to test front-end components
(templates, pages, etc) in the future, though I haven’t figure out
how to achieve this goal yet.</span><br></p>
<p style="margin-bottom:0in;line-height:0.25in;background-image:initial;background-repeat:initial">
<font color="#000000"><font face="Lucida Grande, serif"><font style="font-size:10pt">Could
you give me some suggestions about this?</font></font></font></p></div></blockquote><div><br></div><div>Hi devs,</div><div><br></div><div>I share Jason's confusion above and doubt the usefulness of unit tests that are just asserting for static HTML strings in a dynamic HTML output and one that will keep evolving with course of development.</div><div><br></div><div>Also I wonder about its importance as we move to template system[0], opinions are welcome for possible better ways of doing it. Maybe we can just test for valid input data getting used by the template and some important key words but not HTML tags[1]</div><div><br></div><div><br></div><div>[0] <a href="https://github.com/phpmyadmin/phpmyadmin/pull/1642#discussion_r28551465" target="_blank">https://github.com/phpmyadmin/phpmyadmin/pull/1642#discussion_r28551465</a> <br></div><div>[1] <a href="http://stackoverflow.com/questions/3429218/unit-tests-for-html-output">http://stackoverflow.com/questions/3429218/unit-tests-for-html-output</a></div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr"><p style="margin-bottom:0in;line-height:0.25in;background-image:initial;background-repeat:initial"><font color="#000000"><font face="Lucida Grande, serif"><font style="font-size:10pt">Best
regards,</font></font></font></p>
<p style="margin-bottom:0in;line-height:0.25in;background-image:initial;background-repeat:initial">
<font color="#000000"><font face="Lucida Grande, serif"><font style="font-size:10pt">Jason</font></font></font></p>
<p style="margin-bottom:0in;line-height:100%"><br>
</p></div>
</blockquote></div><br></div><div class="gmail_extra"><br></div><div class="gmail_extra">--</div><div class="gmail_extra">Atul Pratap Singh</div></div>