cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

UI5 MessageStrip Error: Assertion failed: Method 'class' must be called with exactly one class name

M_M
Explorer
0 Likes
339

Hi,

I had an exception in the Console when loading a ui5 page (not Fiori elements), that contains a MessageStrip:

Error: Assertion failed: Method 'class' must be called with exactly one class name

Component: sap.m.MessageStrip
Version affected: 1.143.0+
Version working: 1.142.6
Error: Assertion failed: Method 'class' must be called with exactly one class name
Reproduction: <MessageStrip class="sapUiSmallMargin" text="Test"/>

There are clearly not 2 classes assigned to the MessageStrip. It even occurs if the class tag is not even there. 

Accepted Solutions (0)

Answers (3)

Answers (3)

M_M
Explorer
0 Likes
Hi,
 
@Yogananda, @Filipp thank you for your answers.
 
I thought, that I went through all scenarios. Like removing the MessageStrips in all views and just focus on one. But as Yogananda wrote, that it worked, I went back to triple check. 
 
It took me a while to find something strange. Mea Culpa.
 
I pasted Yoganandas Code next to the other commended MessageStrip, and the error was still there. 
 
The faulty code (of a test project, that nobody would ever see in production, and this editor won't let me highligt it) : 
 
<MessageStrip 
class="sapUiSmallMargin" 
text="Blah" 
showIcon="true" 
visible="{=(${ODataThing>ODataAttr1}.length === 0) ? true : false}" />
 
Basically, if I put the a MessageStrip tag into all places. 
 
But why does it happen? 

The whole structure is a floating content layout with two columns. The 1st column is a list, that 'loads' details into the 2nd column. The 2nd column consists of an ObectPageLayout. The faulty code lives in a fragment (1Fragment) inside of one of the subSections.

<sections>
<ObjectPageSection title="..." id="1Section">
<subSections>
<ObjectPageSubSection id="1SubSection"
visible="{= !${...} }">
<blocks>
<core:Fragment fragmentName="1Fragment" type="XML"/>
</blocks>
</ObjectPageSubSection>
</subSections>

But not only there. I've also got a Wizard in a Dialog fragment, which is triggered on a button from the 1st column. That has MessageStrip tags as well. Same issue with them. 

The question is more, why does it fail when rendering the MessageStrip? Could it be another problem? 

The error message states, that the class method must be called with exactly one class name. If this is referring to CSS classes... It still happens if I remove multiple CSS classes entirely. 



BR
Yogananda
Product and Topic Expert
Product and Topic Expert
0 Likes

@M_M @Filipp 

in version 1.144.0 is working fine with below code. 

			<MessageStrip
				text="Yogananda Warning with default icon and close button:"
				type="Warning"
				showIcon="true"
				showCloseButton="true"
				class="sapUiMediumMarginBottom">
			</MessageStrip>

 

Filipp
Explorer
0 Likes

Hi, @M_M .

This seems like a regression in the MessageStrip renderer. I couldn't find an existing issue for it on the https://github.com/SAP/openui5/issues. Please, consider filing an issue there.

 

M_M
Explorer
0 Likes
I'm not using openui5. I'm using SAP UI5.