예제 #1
0
        public void Test()
        {
            var builder = new TextColumnBuilder();

            builder.SetColumn("a", "b", 20);
            var result = new String();

            result.Append("<td ");
            result.Append("(nzExpandChange)=\"a.collapse(row,$event)\" ");
            result.Append("[nzExpand]=\"a.isExpand(row)\" ");
            result.Append("[nzIndentSize]=\"row.level*20\" ");
            result.Append("[nzShowExpand]=\"!a.isLeaf(row)\"");
            result.Append(">");
            result.Append("<label ");
            result.Append("(nzCheckedChange)=\"a.toggle(row)\" ");
            result.Append("*ngIf=\"a.isShowCheckbox()\" ");
            result.Append("nz-checkbox=\"\" ");
            result.Append("[nzChecked]=\"a.isChecked(row)\" ");
            result.Append("[nzIndeterminate]=\"a.isIndeterminate(row)\">");
            result.Append("{{b}}");
            result.Append("</label>");
            result.Append("<label ");
            result.Append("(click)=\"$event.stopPropagation()\" ");
            result.Append("(ngModelChange)=\"a.checkRowOnly(row)\" ");
            result.Append("*ngIf=\"a.isShowRadio(row)\" name=\"radio_a\" ");
            result.Append("nz-radio=\"\" ");
            result.Append("[ngModel]=\"a.isChecked(row)\">");
            result.Append("{{b}}");
            result.Append("</label>");
            result.Append("<ng-container *ngIf=\"a.isShowText(row)\">");
            result.Append("{{b}}");
            result.Append("</ng-container>");
            result.Append("</td>");
            Assert.Equal(result.ToString(), builder.ToString());
        }
        public void TestColumn()
        {
            var result = new String();

            result.Append("<td>");
            result.Append("{{row.a}}");
            result.Append("</td>");

            Assert.Equal(result.ToString(), _builder.ToString());
        }
        public void TestEmpty()
        {
            var result = new String();

            result.Append("<td>");
            result.Append("</td>");

            _builder = new TextColumnBuilder("", null, null);
            _builder.Init();
            Assert.Equal(result.ToString(), _builder.ToString());
        }
        public void TestTrancate()
        {
            var result = new String();

            result.Append("<td nz-tooltip=\"\" [nzTitle]=\"(row.a|isTruncate:3)?row.a:''\">");
            result.Append("{{row.a|truncate:3}}");
            result.Append("</td>");

            _builder = new TextColumnBuilder("a", 3, null);
            _builder.Init();
            Assert.Equal(result.ToString(), _builder.ToString());
        }
        public void TestColumn()
        {
            var result = new String();

            result.Append("<td>");
            result.Append("{{row.a}}");
            result.Append("</td>");

            var builder = new TextColumnBuilder("a", null, null, false, null);

            builder.Init();
            Assert.Equal(result.ToString(), builder.ToString());
        }
        public void TestContent()
        {
            var result = new String();

            result.Append("<td>");
            result.Append("content");
            result.Append("</td>");

            var content = new DefaultTagHelperContent();

            content.AppendHtml("content");
            _builder = new TextColumnBuilder("a", null, content);
            _builder.Init();
            Assert.Equal(result.ToString(), _builder.ToString());
        }