Brave

In Medieval Scotland, Merida, a young princess of the clan Dunbroch, is given a bow and arrows by her father, King Fergus, for her birthday. Her mother, Queen Elinor, is dismayed. While venturing into the woods to fetch a stray arrow, Merida encounters a will-o'-the-wisp. Soon afterwards, Mor'du, a huge demon-bear, attacks the family. Merida flees on horseback with Elinor, while Fergus fights off Mor'du at the cost of his left leg.
Ten years later, Merida, now a free-spirited young woman, discovers that to her dismay, she is to be betrothed to the son of one of her father's allies. Reminding Merida of a legend of a prince whose pride and refusal to follow his father's wishes destroyed his kingdom, Elinor warns her that failure to consent to the betrothal could harm Dunbroch.
The allied clan chieftains arrive with their first-born sons to compete in the Highland games for Merida's hand in marriage. Merida twists the rules, announcing that she is eligible to compete for her own hand as the first-born of Clan Dunbroch. She defeats each of her suitors in an archery contest, shaming the other clans and leading to an argument with Elinor. When Merida leaves, she follows the wisps to the hut of an elderly witch. Merida bargains with the witch, and receives an enchanted cake that will change her fate.
When Merida gives the cake to Elinor, it causes Elinor to transform into a black bear. Merida returns to the witch's cottage with Elinor, who still retains most of her human personality. The witch has abandoned the cottage but left a message: unless Merida is able to "mend the bond torn by pride" before the second sunrise, the spell will become permanent. Merida and Elinor are led by the wisps to ancient ruins, where they encounter Mor'du. Merida discovers that he was the prince in the legend, transformed by a similar spell. Merida vows to her mother that she will not let her become a wild animal like Mor'du. She believes that she can reverse the spell by repairing a tapestry she damaged during their argument.
The clans are on the verge of war. Having learned the importance of responsibility from her experience with her mother, Merida intends to declare herself ready to choose a suitor as tradition demands. However, with silent encouragement from Elinor, she instead insists that the first-born should be allowed to marry in their own time to whomever they choose. The clans agree, breaking tradition but renewing and strengthening their alliance. Merida sneaks into the tapestry room with Elinor. Elinor, who is losing her humanity, attacks Fergus, but suddenly regains her composure and flees the castle. Mistaking the queen for Mor'du, Fergus pursues the bear with the other clans. With the help of her younger triplet brothers, who have been transformed by the enchanted cake into bear cubs, Merida repairs the torn tapestry while riding after her father. The clans and Fergus capture Elinor, but Merida intervenes before Mor'du attacks. Mor'du scatters the clan warriors and targets Merida. Elinor intercedes, using her bear strength to hold off Mor'du until he is crushed by a falling menhir. This releases the spirit of the prince, who silently thanks Merida for freeing him. As the sun rises for the second time, Merida realizes the mistakes she has made and reconciles with Elinor, causing the queen and the triplets to turn back into humans.
Later, Merida and Elinor work together on a new tapestry when they are called to the docks to bid farewell to the other clans.

Question: What causes Elinor to transform into a black bear?
Answer: the cake Merida gives to Elinor