更改语法ul,li,span

Focus please where start tag

    <ul class="checkbox-list checkbox-list--custom">
        <li class="test container container--sm" n:foreach="$answers as $key => $answer">
            <input type="checkbox" disabled n:attr="checked => $isChecked($key)">
            <span n:class="$isCorrect($key) ? 'text-success', $isIncorrect($key) ? 'test1'">
                {$answer->getAnswerText()}
            </span>
        </li>
    </ul>

I would like move content inside span element to li element

This is current status This is required status

As the error message tells you, you cannot currently mix class and n:class attributes in a single element. However, you can move the classes from the class attribute to n:class and that should work:

<ul class="checkbox-list checkbox-list--custom">
    <li n:foreach="$answers as $key => $answer" n:class="test, container, container--sm, $isCorrect($key) ? text-success, $isIncorrect($key) ? test1">
        <input type="checkbox" disabled n:attr="checked => $isChecked($key)">
        {$answer->getAnswerText()}
    </li>
</ul>

It also should not be necessary to quote the classes in n:class attribute.